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

Pete Cervasio cervasio at airmail.net
Thu Nov 3 19:13:11 CET 2011


On Thursday, November 03, 2011 11:03:36 am Hans-Peter Diettrich wrote:
> Sven Barth schrieb:
> > And functions like DateTimeToStr don't care whether a time value is
> > local or UTC and in my opinion they even MUST NOT.
> 
> Splitting the TDateTime into year, month etc. is done by a DecodeDate...
> function, that *assumes* that TDateTime contains a local time. When you
> feed it an UTC time, the result is unusable.

What?  How does it assume it's in local time?  It assumes it has received the 
value you want decoded.  The value 40850.5 treated as a TDateTime is 03 NOV 
2011 @ 12:00.  No matter what time zone it's expressed in, the result is the 
same, but in that zone.  If you want a different zone, you have to add in the 
offset before decoding.

How is that unusable?

Best regards,
Pete C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20111103/ae05ea68/attachment.html>


More information about the fpc-devel mailing list