[fpc-devel] Problem with Now() and time changed by ntpd

zeljko zeljko at holobit.net
Tue Nov 1 10:04:11 CET 2011


> fpgettimeofday uses exactly what it says on the tin: gettimeofday. See
> here: http://linux.die.net/man/2/gettimeofday
> 
> The fp* functions in Linux by default call directly the kernel instead
> of going through libc, thus avoiding the dependency on that library.
> 
> Maybe a possibilty should be implemented in unit Unix to reread the
> timezone file. This wouldn't solve your problem directly, but it would
> at least provide the ability to update the time zone information without
> restarting the application/service. The trigger would need to come from
> an external source though (maybe by checking that timezone database that
> was in the media some weeks ago).

There is possibility:

gettimeofday() can result in incorrect timings if there are processes on your 
system that change the timer (ie, ntpd). On a "normal" linux, though, I 
believe the resolution of gettimeofday() is 10us. It can jump forward and 
backward and time, consequently, based on the processes running on your 
system. 
Look into clock_gettime(CLOCK_MONOTONIC) for timing intervals. It suffers from 
several less issues due to things like multi-core systems and external clock 
settings. 
Also, look into the clock_getres() function.

So should I open an issue about this ?

zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20111101/ba9d0c75/attachment.html>


More information about the fpc-devel mailing list