From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d1f23f0bd3971bec X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Timing Block of GNAT code in milliseconds Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1114090119.383842.20950@l41g2000cwc.googlegroups.com> <1KydnfadqcK30fXfRVn-qw@comcast.com> <10m95m5yelieq$.kj1rktb792s3.dlg@40tude.net> Date: Sat, 30 Apr 2005 12:02:55 +0200 Message-ID: <1id7q9mdornmv.ymcokx092sok$.dlg@40tude.net> NNTP-Posting-Date: 30 Apr 2005 12:02:50 MEST NNTP-Posting-Host: b5df2c5d.newsread4.arcor-online.net X-Trace: DXC=STP[>gE7Z8ZH^J66Eo??P_:ejgIfPPldTjW\KbG]kaMXliQbn6H@_EY>l[?XfUcQk][6LHn;2LCV^COgUkn_?_Y_WiRECcWkSVW X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:10851 Date: 2005-04-30T12:02:50+02:00 List-Id: On Fri, 29 Apr 2005 15:52:55 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" 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, 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