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

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Nov 2 00:02:09 CET 2011


On 01 Nov 2011, at 23:01, Marco van de Voort wrote:

> That is an symmetrical argument. I could argue exactly the same about
> correctness. I don't need it, so please don't force it on all users.

I suppose you meant that what is correct and what not depends on the specification, rather than than that correctness is an optional design goal. It is possible to specify that the now() call from sysutils is only guaranteed to be correct relative to the timezone settings when the program was started. This would however be Delphi-incompatible (performance differences between Delphi and FPC implementations exist in many more places than just this one, so I'm mainly considering the functionality aspect), and imho if you need "real time behaviour" then using high level routines from the sysutils unit is the wrong way to go since there are no implementation guarantees whatsoever there.

Generally, if you need to time things at a high precision level with minimal overhead, then timezones etc don't matter. In fact, then you probably want to ignore them since the timing deltas matter rather than whatever the user perceives as "how late is it now". Timezone or daylight saving shifts will completely mess up any timing in such cases. If you are in a case where you do want a high precision timer that is only adjusted once to the system's timezone (namely when the program was started), then I think it is quite reasonable if the RTL does not provide such functionality in a standard call.


Jonas


More information about the fpc-devel mailing list