Commit 5eb19341102e6f6bec7b2589c94253248c53f08e

Con Kolivas 2013-10-07T20:38:24

Limit ms_tdiff to 1 hour as a sanity check.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/util.c b/util.c
index b877e34..7199f5a 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;
 }