[fpc-pascal] FileAge and timezone

Michael Van Canneyt michael at freepascal.org
Thu Oct 30 15:21:37 CET 2014



On Thu, 30 Oct 2014, Mattias Gaertner wrote:

> On Thu, 30 Oct 2014 14:40:56 +0100 (CET)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>
>>
>>
>> On Thu, 30 Oct 2014, Mattias Gaertner wrote:
>>
>>> 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?
>>
>> That depends on the OS. FileAge returns whatever the OS returns.
>
> Some OS has several functions/options, so there is a choice.

Not really if you want to follow delphi compatibility.

>
>
>> 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

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.



More information about the fpc-pascal mailing list