Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-03

Is there a function that returns UTC time in FPC or Lazarus?

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers
to Frank Church
Frank Church wrote 6 lines
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

Reply by email

João Marcelo Vaz
to Reinier Olislagers

2012/3/30 Reinier Olislagers

Show quoted text 22 lines
On 30-3-2012 16:05, Frank Church wrote: > 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 --

PascalTZ does that.

http://wiki.lazarus.freepascal.org/PascalTZ

Jo?o Marcelo http://blog.caixadepandora.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120330/4e233ecb/attachment.html>

Reply by email

Reinier Olislagers
to João Marcelo Vaz: 2012/3/30 Reinier Olislagers PascalTZ does that.…
Jo?o Marcelo Vaz wrote 14 lines
2012/3/30 Reinier Olislagers < <mailto:>> On 30-3-2012 16:05, Frank Church wrote: > Is there a function that returns the UTC time, either as a UnixTime or > TDateTime irregardless of timezone? There is a separate unit that deals with this, IIRC, the wiki mentions it somewhere.. Regards, Reinier PascalTZ does that. http://wiki.lazarus.freepascal.org/PascalTZ

Thanks, Jo?o, that's the one I meant!

Reinier

Reply by email

Felipe Monteiro de Carvalho

In the package lazutils there is:

unit lazutf8sysutils;
....
function NowUTC: TDateTime;
function GetTickCount64: QWord;
Felipe Monteiro de Carvalho

Reply by email

Frank Church
to Frank Church: When I get the time via the DateTime function result is adapted for the timezone, making…
Frank Church wrote 11 lines
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 Church ======================= http://devblog.brahmancreations.com

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.

Frank Church ======================= http://devblog.brahmancreations.com

Reply by email