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

Tomas Hajny XHajT03 at hajny.biz
Tue Nov 1 11:58:06 CET 2011


On Tue, November 1, 2011 11:36, Felipe Monteiro de Carvalho wrote:
> One idea: In Now if you read the timezones, then store the value of
> Now. In subsequent calls check if 1 hour has passed since the last
> time the timezones were checked. If yes, then update the timezones and
> store this new base value of Now.
>
> This makes a compromise between speed and correctnees. It would at
> most be wrong for 1 hour during a long running application. For other
> applications which call Now very frequently we only add some value
> checkes more to the overhead, which shouldn't be expensive.

Comparing to the DST transition time as suggested in my previous e-mail
(and also mentioned by Michael) is probably equally expensive in terms of
runtime overhead (except for the initialization, but that isn't a major
factor) but more accurate.

Tomas





More information about the fpc-devel mailing list