Lin George wrote:
I am not sure whether it is the correct place to ask a bug of gettimeofday here.
..
I found sometimes the time will not be increased, but will be decreased. It does not happen each time, but happens rarely.
gettimeofday() is platform dependent, and not a part of gcc. If you
want details, you should at least look at the source code for your
implementation (e.g. glibc). It is likely that your system hardware has
relatively low resolution (e.g. 0.001 sec at best) for the date/time
clock, and gettimeofday() has to make some compromise to interpolate,
for example by using CPU clock ticks. That would have pitfalls such as
variations in clock speed, or discrepancies between your CPUs.