You can use LazSysUtils.NowUTC, and then there is also PascalTZ package if you want to convert between timezones.

There is a ticket with a patch for adding a similar function to FPC, but it needs some attention: https://bugs.freepascal.org/view.php?id=30394 <https://bugs.freepascal.org/view.php?id=30394>

Regards,
Denis


On 03/05/2021 14:59, Bo Berglund via lazarus wrote:
If I use Now() to retrieve a TDateTime value I get it in whatever timezone
(including DST) the box I run on is set to...
And there is no indication of the timezone used (TDateTime is just a double
after all).

So now I wonder if there is some kind of globally constant time one can read
which can be used in scheduling applications no matter what time zone is used.
For example something like NowUTC() or similar?

I have been struggling with the user part of a remote monitoring system, which
will run on a RaspberryPi under Linux (Debian flavour).

And there are lots of problems when going between the actual remote system and
the config application because of the time zone differences.
It would help a lot if one could use a time that is not messed with and is the
same everywhere...

The important thing here is that two systems located at different places on
Earth should agree on such a time value if it is taken at the same absolute
instant.

And what is the useful resolution of the times?
seconds, miliseconds or what?


--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to