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

zeljko zeljko at holobit.net
Thu Nov 3 07:44:47 CET 2011


On Wednesday 02 of November 2011 23:45:53 Martin Schreiber wrote:
> On Wednesday 02 November 2011 17.43:56 Martin Schreiber wrote:
> > On Wednesday 02 November 2011 17.13:49 Jonas Maebe wrote:
> > > Yes, the result slower, but it's also correct (as in "it makes sure
> > > that the actual local time is returned"). Just like all UTF-16 code in
> > > the RTL is slower than what Martin Schreiber would like, and we didn't
> > > change it to UCS-2 when he asked to do so for speed reasons.
> > 
> > ???
> > I never asked this. I asked not to use new code page aware stringtype
> > instead of pre cpstrnew UnicodeString, not to use 16 bit strings in
> > component names and the like and not to use non ASCII characters in RTTI
> > and Pascal identifiers.
> > I fully agree with your argumentation about Now(). MSEgui already has a
> > nowutc() function, I'll add nowlocal() which will use mselibc on Linux.
> 
> The results with 10'000'000 calls:
> 
> FPC Now() MSEgui nowutc() MSEgui nowlocal()
> 
> Linux
>   15.29s           3.39s             3.57s
> 
> Windows
>   10.00s           1.22s             1.37s

Have you tried latest Michael's patch for getttimeofday ?
It used 2 calls 1 to gettimeofday and 1 to fptime, now it uses only 
gettimeofday syscall and it's twice faster.
So: your nowutc() and nowlocal() returns timings which I have with my 
implementation of Now() by using syscall clock_gettime(CLOCK_REALTIME).
After Michal patched current trunk , gettimeofday have same timing.
Overhead of Now() is now fixed in trunk.
Don't know anything about windows...maybe it should be reviewed for 
unnecesarry calls.

zeljko




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20111103/107a2a5e/attachment.html>


More information about the fpc-devel mailing list