Corrected the length variable including length of timestampt string which doesn't include terminating null.