comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Timing Block of GNAT code in milliseconds
Date: Sat, 30 Apr 2005 12:02:55 +0200
Date: 2005-04-30T12:02:50+02:00	[thread overview]
Message-ID: <1id7q9mdornmv.ymcokx092sok$.dlg@40tude.net> (raw)
In-Reply-To: oaidnWyBSNGQA-_fRVn-jg@megapath.net

On Fri, 29 Apr 2005 15:52:55 -0500, Randy Brukardt wrote:

> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:10m95m5yelieq$.kj1rktb792s3.dlg@40tude.net...
> ...
>> We need time stamps synchronized across the network. The accuracy of
>> synchronization is the second problem. The first problem is that the very
>> idea of synchronized time stamps cannot be expressed in Ada terms. There is
>> no portable way to get say UTC from either Calendar or Real_Time, or to
>> convert UTC to them.
> 
> Of course there is (assuming that you have a compiler that supports the Ada
> 2006 Ada.Calendar.Time_Zone and Ada.Calendar.Formatting.Split packages).
> 
> declare
>      Now : Ada.Calendar.Time := Ada.Calendar.Clock;
>      UTC_Offset : Ada.Calendar.Time_Zones.Time_Offset :=
>            Ada.Calendar.Time_Zones.UTC_Time_Offset (Now);
> begin
>     Ada.Calendar.Formatting.Split (Now, Time_Zone => UTC_Offset, <other
> parts of the UTC time>);

I do hope that there is a Time_Zone which does mangle time!

>     ...
> end;
> 
> It's a bit clunky, but that is the price of undoing daylight savings time.
> If your time period is short enough (doesn't cross any hour boundaries in
> the early morning), you can just get the offset once.
> 
> And you can use Time_Of with a Time_Zone parameter to construct a value.

It is a perversion. It is local political time which is derived from UTC
not otherwise. Then the time span mandated by Ada.Calendar is too short,
precision is too low (for time stamping accuracy is not an issue.)

BTW I think we could safely replace Ada.Calendar.Clock with UTC clock, but
that would make some elder Ada library implementations illegal.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



      reply	other threads:[~2005-04-30 10:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-21 13:28 Timing Block of GNAT code in milliseconds markp
2005-04-21 18:00 ` tmoran
2005-04-21 18:53   ` markp
2005-04-21 19:40     ` Marc A. Criley
2005-04-21 19:44     ` Simon Wright
2005-04-22  1:00   ` Steve
2005-04-23  5:39     ` Simon Wright
2005-04-23 17:49       ` Steve
2005-04-24 18:57         ` Simon Wright
2005-04-24 20:05           ` Dmitry A. Kazakov
2005-04-25 22:56             ` Randy Brukardt
2005-04-28 20:26             ` Simon Wright
2005-04-29  8:11               ` Dmitry A. Kazakov
2005-04-29 18:25                 ` tmoran
2005-04-29 19:19                   ` Dmitry A. Kazakov
2005-04-29 20:24                     ` tmoran
2005-04-30  9:47                       ` Dmitry A. Kazakov
2005-04-29 20:52                 ` Randy Brukardt
2005-04-30 10:02                   ` Dmitry A. Kazakov [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox