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

Tomas Hajny XHajT03 at hajny.biz
Mon Oct 31 23:49:16 CET 2011


On 31 Oct 11, at 20:17, Michael Van Canneyt wrote:
> On Mon, 31 Oct 2011, zeljko wrote:
> 
> > 
> > Hi,
> > 
> > 
> > I have daemon which uses Now() for getting current date/time, but something is wrong, time on server changed from 03:00
> > to 02:00 this weekend, but daemon's Now() was on old time ... until now ... I've just restarted it and now it applied
> > new time.
> > 
> > fpc-2.4.5, centos 5.5 ....
> > 
> > Also this confirms something what happens sometimes when ntpd changes time ...
> > 
> > Any hints ? What to do ? Any workaround ?
> 
> It's probably the timezone information which is loaded only once at program startup.
> 
> This has been reported before, but no satisfying solution was found at the time.
> re-reading this file at each now() would be extremely slowing.

Sorry for a silly question but isn't the DST transition time stored 
within the same timezone definition file? If it is then you might 
calculate and store the next DST transition time coming after the 
time of initialization, compare it to the time requested for 
translation in EpochToLocal and trigger re-initialization of both 
TZSeconds and the next transition time whenever the original DST 
transition time is crossed...

Tomas




More information about the fpc-devel mailing list