Thread: Updated code to test gettimeofday() ...

Updated code to test gettimeofday() ...

From
"Marc G. Fournier"
Date:
Just as an FYI, there are continuing talks on FreeBSD's mailng lists about
this issue, in hopes of getting it corrected ... if anyone here is using
FreeBSD, you'll want to check out the -current mailing list, where
discussions are taking place ...

Update code for testing is included here, though, with which
Poul-Henning(sp?) is requesting problem reports issued against ...

#include <stdio.h>
#include <sys/time.h>

int
main()
{       struct timeval prevtime;       struct timeval curtime;       double last, now;
       gettimeofday(&prevtime, NULL);       last = prevtime.tv_sec + prevtime.tv_usec * 1e-6;
       for (;;)       {               gettimeofday(&curtime, NULL);               now = curtime.tv_sec +
curtime.tv_usec* 1e-6;
 
               if (now < last) {                       printf("%f %f %d.%06d %d.%06d\n", now, last,
     curtime.tv_sec, curtime.tv_usec,                           prevtime.tv_sec, prevtime.tv_usec);               }
         last = now;               prevtime = curtime;       }
 
       return 0;
}


----
Marc G. Fournier           Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org           Yahoo!: yscrappy              ICQ: 7615664