[fpc-devel] Problem with Now() and time changed by ntpd
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Thu Nov 3 17:38:01 CET 2011
Sven Barth schrieb:
> FPC's Now on Windows uses GetLocalTime as well. For its implementation
> please take a look here:
> http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/time.c?revision=52912&view=markup
> (line 277ff)
That code doesn't make sense, without additional information :-(
283 do
284 {
285 SystemTime.HighPart = SharedUserData->SystemTime.High1Time;
286 SystemTime.LowPart = SharedUserData->SystemTime.LowPart;
287 }
288 while (SystemTime.HighPart !=
SharedUserData->SystemTime.High2Time);
As long as no functions are involved, the loop copies the same
information into SystemTime, over and over again.
>> On POSIX
>> platforms gettimeofday and localtime_r is used instead (Delphi XE). All
>> this handling makes Now() quite expensive, so that (a future) FPC should
>> provide cheaper means for getting time stamps.
>
> The problem with localtime_r itself is that it's implemented in LibC
> which must be avoided for the non-LibC-RTL. So FPC definitely must
> provide an implementation of its own for this.
Then something like WinAPI SystemTimeToTzSpecificLocalTime has to be
implemented. That function can be used for every platform, provided that
the SystemTime is stored in an platform independent way.
DoDi
More information about the fpc-devel
mailing list