rem: sprintf (str, "%d.%d", tv.tv_sec, tv.tv_usec);
add: sprintf (str, "%ld.%ld", tv.tv_sec, tv.tv_usec);
context: static char* time2str(struct timeval& tv){  static char str[32];  sprintf (str, "%d.%d", tv.tv_sec, tv.tv_usec);  return str;}