[fpc-devel] Problem with Now() and time changed by ntpd
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Fri Nov 4 11:28:50 CET 2011
Sven Barth schrieb:
>> 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.
The use of different types, for Windows local and system time, requires
either a conversion when a UTC (system) time is assigned to a TDateTime
variable, or overloaded functions are required for dealing with such
different encodings. Currently the conversion from SystemTime (record)
into TDateTime (Double) makes the TDateTime contain the *local* time,
not the UTC time. That's why I wonder how you want to place an true UTC
time value into a TDateTime - can you give some code?
> And still: It does not matter whether we are talking about local or UTC
> time here.
It does, as long as there is no guarantee that UTC and local time start
at the exactly same date and time.
DoDi
More information about the fpc-devel
mailing list