[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: "Your system clock just jumped" on Debian+VMware ESX
> I'm guessing this is a kernel thing, so running "date" a lot will probably
> not help to notice it. Is gettimeofday() the wrong way to ask what time
> it is under vmware? :)
Using select (or poll) and gettimeofday, while not technically
correct, is the only portable way of writing an even-driven program
under Unix. I can't believe that vmware might not support this technique.
The issue with the above technique is that it's vulnerable to clock
stepping. The correct wa is to use clock_gettime(CLOCK_MONOTONIC)
rather than gettimeofday, but it's supported on precious few systems.
(The older BSD technique of using select and checking the time spent
in select is not only not portable, but it's also not correct since it
causes skew.)
Juliusz