When I get the time via the DateTime function result is adapted for the timezone, making it an hour ahead now?
Is there a function that returns the UTC time, either as a UnixTime or TDateTime irregardless of timezone?

Mailing lists / lazarus / 2012-03
7 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
When I get the time via the DateTime function result is adapted for the timezone, making it an hour ahead now?
Is there a function that returns the UTC time, either as a UnixTime or TDateTime irregardless of timezone?
Frank,
You could search the fpc and lazarus mailing list; I know there've been posts regarding this.
IIRC, the conclusion was that doing this is potentially very difficult to do cross platform, keeping daylight saving changes etc in mind.
There is a separate unit that deals with this, IIRC, the wiki mentions it somewhere..
Regards,
Reinier
2012/3/30 Reinier Olislagers
PascalTZ does that.
http://wiki.lazarus.freepascal.org/PascalTZ
When I get the time via the DateTime function result is adapted for the timezone, making…
where are you reading from? the RTC or the OS clock?
2012/3/30 Reinier Olislagers PascalTZ does that.…
Thanks, Jo?o, that's the one I meant!
Reinier
In the package lazutils there is:
unit lazutf8sysutils;
....
function NowUTC: TDateTime;
function GetTickCount64: QWord;When I get the time via the DateTime function result is adapted for the timezone, making…
PascalTZ appears to be the most recommended one. I will go with it and see. If it comes to the worst, I will consider looking up the time from an NTP server to see how it compares as a check.