Prevent server from stalling if time goes backwards (M. Vallevand)

This commit is contained in:
mmdolze committed 2009-02-24 21:09:52 +00:00
1 parent 6b4c2d917b
commit 71c2f5cf18
2 files changed
+2 -1

No files matched your search

+1 -1
View File
@@ -810,7 +810,7 @@ do_mainloop(void)
#ifndef WIN32
gettimeofday(&t, NULL);
t_diff = t.tv_sec - last_t.tv_sec;
if ((t_diff + 1) > (LONG_MAX / 1e6)) {
if ( ((t_diff + 1) > (LONG_MAX / 1e6)) || (t_diff < 0) ) {
/* We're going to overflow the calculation - probably been to sleep, fudge the values */
t_diff = 0;
process_lag = 1;