X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Frx%2Frx_clock.c;h=06d6a59122afc55e2f4feff6957b8b9a787298d7;hp=63213fcf3a6b0fa25ceaec5ce1fafa2c55ac6ba6;hb=70a8bba77b7e03d29edd8fab9b1cac098d1a7338;hpb=37f7895c48c2a5cafae15ae79d04f196e6fa6989 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++;