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

This commit is contained in:
mmdolze
2009-02-24 21:09:52 +00:00
parent 6b4c2d917b
commit 71c2f5cf18
2 changed files with 2 additions and 1 deletions
+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;