[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

incorrect result returned from 'gettimeofday'



Hi everyone:

I have been trying to port censemble package (which is time sensitive) onto
etrax board, and found sometimes system call 'gettimeofday' return incorrect
value for microsecond field (tv_usec over a million).  Here is the return
value I got:

(kernel 2.4.5 on etrax, cris-dist-1.15 on Mandrake8.0 kernel 2.4.8-34)

tv_sec = 1014821653, tv_usec = 21639569

You can see here tv_usec is over a million, and that is not right.  So I
wrote a small program which just repeatedly call 'gettimeofday' in a loop,
the same problem occurred 399 times in a million calls.

Anyone knows why this happened, and how to fix it?

Best regards,

Shihai