Hi,
The docs of FileAge does not mention if timezone is used or not.
http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/fileage.html
Is the returned OS time stamp with or without timezone?
Mattias

Mailing lists / fpc-pascal / 2014-10
5 messages · 3 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi,
The docs of FileAge does not mention if timezone is used or not.
http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/fileage.html
Is the returned OS time stamp with or without timezone?
Mattias
That depends on the OS. FileAge returns whatever the OS returns.
The following is based on memory alone, needs to be checked in code: It doesn't do any transformations, so I expect it actually to be UTC. Only when converting to TDateTime is the timzeone introduced.
Michael.
Some OS has several functions/options, so there is a choice.
The following is based on memory alone, needs to be checked in code: It doesn't do any transformations, so I expect it actually to be UTC. Only when converting to TDateTime is the timzeone introduced.
Under Linux I see UTC.
But on Windows it seems to return with timezone. See this bug: http://bugs.freepascal.org/view.php?id=26963
Mattias
Not really if you want to follow delphi compatibility.
Quite possible: like I said, it depends on the OS. The change to TDateTime should take care of that by converting it always to local time. If you want it always in UTC for internal reasons, then additional functions need to be developed: On linux that will be a No-op, on windows it will need to take care of some stuff...
For what it is worth:
Delphi has exactly the same problem as in the bug, as well as TortoiseSVN ... (at least it used to have, I remember booting my VM to suddenly see all files marked 'changed')
Michael.
On Windows it's UTC too.
The Windows API function "FindFirstFileW" gives
back a data structure where the dates are UTC times. So to get local times you need to convert with "FileTimeToLocalFileTime".