Browse Source

Limit ms_tdiff to 1 hour as a sanity check.

nfactor-troky
Con Kolivas 11 years ago
parent
commit
97b5dd08b2
  1. 5
      util.c

5
util.c

@ -1081,8 +1081,9 @@ double us_tdiff(struct timeval *end, struct timeval *start)
/* Returns the milliseconds difference between end and start times */ /* Returns the milliseconds difference between end and start times */
int ms_tdiff(struct timeval *end, struct timeval *start) int ms_tdiff(struct timeval *end, struct timeval *start)
{ {
if (unlikely(end->tv_sec - start->tv_sec > 60)) /* Like us_tdiff, limit to 1 hour. */
return 60000; if (unlikely(end->tv_sec - start->tv_sec > 3600))
return 3600000;
return (end->tv_sec - start->tv_sec) * 1000 + (end->tv_usec - start->tv_usec) / 1000; return (end->tv_sec - start->tv_sec) * 1000 + (end->tv_usec - start->tv_usec) / 1000;
} }

Loading…
Cancel
Save