[Lazarus] Is there a global timezone-independent time available?
Bo Berglund
bo.berglund at gmail.com
Mon May 3 23:22:17 CEST 2021
On Mon, 3 May 2021 20:28:43 +0200 (CEST), Michael Van Canneyt via lazarus
<lazarus at lists.lazarus-ide.org> wrote:
>
>
>On Mon, 3 May 2021, Denis Kozlov via lazarus wrote:
>
>> 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>
>
>I'm terribly sorry, I totally forgot about this bugreport :/
>
>But Ondrej Pokorny has meanwhile implemented NowUTC and other related functions that
>allow more flexibility regarding the timezone.
>
>So, Mr. Berglund, with FPC trunk, your problem will be solved.
>I'm not sure it will be in 3.2.2, because it is rather sensitive.
>
I only run with released versions so I will wait until then.
I guess I can always do this to get an UTC timestamp:
function MyNowUTC: TDateTime;
begin
Result := LocalTimeToUniversal(Now);
end;
Now I am at least running an UTC clock on screen using this call.
--
Bo Berglund
Developer in Sweden
More information about the lazarus
mailing list