From: Chaskiel M Grundman Date: Sun, 20 Mar 2005 19:23:19 +0000 (+0000) Subject: amd64-linux-rx-clock-fix-20050320 X-Git-Tag: openafs-devel-1_5_0~713 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=70a8bba77b7e03d29edd8fab9b1cac098d1a7338 amd64-linux-rx-clock-fix-20050320 FIXES 17950 avoid initial delay in rx on amd64 linux due to interval timer issue --- diff --git a/src/rx/rx_clock.c b/src/rx/rx_clock.c index 63213fc..06d6a59 100644 --- a/src/rx/rx_clock.c +++ b/src/rx/rx_clock.c @@ -54,6 +54,7 @@ RCSID #else #define STARTVALUE 100000000 /* Max number of seconds setitimer allows, for some reason */ #endif +static int startvalue = STARTVALUE; struct clock clock_now; /* The last elapsed time ready by clock_GetTimer */ @@ -81,6 +82,10 @@ clock_Init(void) fflush(stderr); exit(1); } + getitimer(ITIMER_REAL, &itimer); + startvalue = itimer.it_value.tv_sec; + if (itimer.it_value.tv_usec > 0) + startvalue++; clockInitialized = 1; } @@ -101,7 +106,7 @@ clock_UpdateTime(void) { struct itimerval itimer; getitimer(ITIMER_REAL, &itimer); - clock_now.sec = STARTVALUE - 1 - itimer.it_value.tv_sec; /* The "-1" makes up for adding 1000000 usec, on the next line */ + clock_now.sec = startvalue - 1 - itimer.it_value.tv_sec; /* The "-1" makes up for adding 1000000 usec, on the next line */ clock_now.usec = 1000000 - itimer.it_value.tv_usec; if (clock_now.usec == 1000000) clock_now.usec = 0, clock_now.sec++;