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

Sven Barth pascaldragon at googlemail.com
Thu Nov 3 21:23:58 CET 2011


Am 03.11.2011 21:11, schrieb Hans-Peter Diettrich:
> Pete Cervasio schrieb:
>
>> > 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.
>
> How do you get the starting date and time of the epoch?
>
> According to Delphi help a TDateTime of 0.0 represents 12/30/1899 12:00
> am, while Wikipedia states "start counting the seconds from the Unix
> epoch of 1970-01-01T00:00:00 UTC".

You are aware that the definition of TDateTime and that of the Unix 
timestamp are not supposed to be the same? The original TDateTime 
definiton (Delphi 1 and maybe also 2) started from 01/01/0001 and was 
later changed to todays 12/30/1899 to be COM compatible.

And still: It does not matter whether we are talking about local or UTC 
time here.

Regards,
Sven




More information about the fpc-devel mailing list