Re: [fpc-pascal] FileAge and timezone

2014-10-30 Thread Michael Van Canneyt



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.

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.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FileAge and timezone

2014-10-30 Thread Mattias Gaertner
On Thu, 30 Oct 2014 14:40:56 +0100 (CET)
Michael Van Canneyt mich...@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.


 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
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FileAge and timezone

2014-10-30 Thread Michael Van Canneyt



On Thu, 30 Oct 2014, Mattias Gaertner wrote:


On Thu, 30 Oct 2014 14:40:56 +0100 (CET)
Michael Van Canneyt mich...@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.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FileAge and timezone

2014-10-30 Thread Jürgen Hestermann


Am 2014-10-30 um 15:21 schrieb Michael Van Canneyt:

On Thu, 30 Oct 2014, Mattias Gaertner wrote: 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...


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.



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] FileAge and timezone

2014-10-29 Thread Mattias Gaertner
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
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal