Don't complain that someone's changed the clock unless the time

after a select() interrupt is more than 1 second past what
should have been the end time.
We may just be running on an over-burdened machine.
This commit is contained in:
Brian Somers 1997-12-29 22:23:52 +00:00
parent b2167e32a4
commit f7d8bb14f0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=32103

View file

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: timer.c,v 1.24 1997/11/22 03:37:52 brian Exp $
* $Id: timer.c,v 1.25 1997/12/28 21:55:04 brian Exp $
*
* TODO:
*/
@ -224,8 +224,8 @@ nointr_dosleep(u_int sec, u_int usec)
break;
} else {
gettimeofday(&to, NULL);
if (to.tv_sec > et.tv_sec ||
(to.tv_sec == et.tv_sec && to.tv_usec > et.tv_usec) ||
if (to.tv_sec > et.tv_sec + 1 ||
(to.tv_sec == et.tv_sec + 1 && to.tv_usec > et.tv_usec) ||
to.tv_sec < st.tv_sec ||
(to.tv_sec == st.tv_sec && to.tv_usec < st.tv_usec)) {
LogPrintf(LogWARN, "Clock adjusted between %d and %d seconds "
@ -237,7 +237,8 @@ nointr_dosleep(u_int sec, u_int usec)
et.tv_usec = st.tv_usec + usec;
to.tv_sec = sec;
to.tv_usec = usec;
} else if (to.tv_sec == et.tv_sec && to.tv_usec == et.tv_usec) {
} else if (to.tv_sec > et.tv_sec ||
(to.tv_sec == et.tv_sec && to.tv_usec >= et.tv_usec)) {
break;
} else {
to.tv_sec = et.tv_sec - to.tv_sec;