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

zeljko zeljko at holobit.net
Wed Nov 2 15:53:39 CET 2011


On Wednesday 02 of November 2011 15:47:46 you wrote:
> On Wed, 2 Nov 2011, zeljko wrote:
> > On Wednesday 02 of November 2011 14:53:05 you wrote:
> >> You must do also a localtime_r after this call.
> >> clock_gettime returns the same time as gettimeofday.
> > 
> > But point IS in comparing clock_gettime() vs. gettimeofday() which is
> > used by fpgettimeofday(). I don't see localtime_r() calls in current RTL
> > Now().
> 
> Ok.
> 
> It turns out that Now() was doing a fpGettimeofday (for time) and a fptime
> (for date), which is of course really stupid.

Yes, I saw that after posted example.

> 
> I improved that (it does one call only). So, new stats, 64-bit, no
> optimizations:
> 
> sb: >./unixclocks
> RTL Now() with 10000000 calls = 3698 ms
> Kernel clock_gettime() NowReal() with 10000000 calls = 6564 ms
> 
> Revision 19572.
> 
> The time is now less than the Libc time you posted (5085ms).

I don't care about libc timing, but why clock_gettime() is so slower now ? It 
is called only once in my example. Are you sufre that RTL now() returns 
correct date/time ?


> 
> I can't test the libc version, but if you'd care to re-test using the above
> revision of unix/sysutils.pp, and post the results, I'd be grateful.

Sorry, but I don't want to use 2.7.1 until it's useable.

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


More information about the fpc-devel mailing list