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.

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 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.

Michael.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to