From 936fca4de90787fe9c1133918f82daad26b6eb68 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 7 Oct 2013 20:38:24 +1100 Subject: [PATCH] Limit ms_tdiff to 1 hour as a sanity check. --- util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util.c b/util.c index b877e349..7199f5a9 100644 --- a/util.c +++ b/util.c @@ -1081,8 +1081,9 @@ double us_tdiff(struct timeval *end, struct timeval *start) /* Returns the milliseconds difference between end and start times */ int ms_tdiff(struct timeval *end, struct timeval *start) { - if (unlikely(end->tv_sec - start->tv_sec > 60)) - return 60000; + /* Like us_tdiff, limit to 1 hour. */ + 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; }