Delphi FileDate is UTC time based because the windows API FILETIME structure is UTC based. Delphi exposes the FileTimeToLocalFileTime API call to get the local time.
The fpc unix implementation uses LocalToEpoch (unixutil.pp) which has the folloxing comments:
{
Transforms local time (year,month,day,hour,minutes,second) to Epoch time (seconds since 00:00, january 1 1970, corrected for local time zone) }
I guess fpc wants to be Delphi compatible as much as possible.
Ludo
Earlier message 28 lines
-----Message d'origine-----
De :
De la part de Carsten Bager
Envoyé : jeudi 19 mai 2011 08:58
À : FPC-Pascal users discussions
Objet : [fpc-pascal] DateTimeToFileDate
If I do this on a Linux machine
(Free Pascal Compiler version 2.4.2 [2010/11/08] for i386)
WriteLn(DateTimeToFileDate(Now));
WriteLn(trunc((now-EncodeDate(1970,1,1))*86400));
I get this
1305786833
1305794033
There is a difference of 7200= 2 hours.
Is this correct?
I would not expect a difference of 2 hours (the deference from UTC).
Regards
Carsten