Re: [Lazarus] Is there a global timezone-independent time available?

2021-05-03 Thread Bo Berglund via lazarus
On Mon, 3 May 2021 20:28:43 +0200 (CEST), Michael Van Canneyt via lazarus
 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 
>> 
>
>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

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


Re: [Lazarus] Is there a global timezone-independent time available?

2021-05-03 Thread Marco van de Voort via lazarus


Op 2021-05-03 om 20:28 schreef Michael Van Canneyt via lazarus:



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.


Indeed, it (r47306) /won't be in 3.2.2

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


Re: [Lazarus] Is there a global timezone-independent time available?

2021-05-03 Thread Michael Van Canneyt via lazarus



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 



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.

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


Re: [Lazarus] Is there a global timezone-independent time available?

2021-05-03 Thread Denis Kozlov via lazarus
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 



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


[Lazarus] Is there a global timezone-independent time available?

2021-05-03 Thread Bo Berglund via lazarus
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?

-- 
Bo Berglund
Developer in Sweden

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