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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,aa60d56d22a287d1 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!a12g2000yqm.googlegroups.com!not-for-mail From: Martin Newsgroups: comp.lang.ada Subject: Re: Newbie Q: How to program in UTC (time/calendar) ? Date: Tue, 24 Mar 2009 05:49:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: <572820e4-9243-42aa-b05f-fc4dd8ac4ade@a12g2000yqm.googlegroups.com> References: <89277c47-788d-441c-95b2-f47e1b70a532@j39g2000yqn.googlegroups.com> NNTP-Posting-Host: 20.133.0.8 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1237898951 25339 127.0.0.1 (24 Mar 2009 12:49:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 24 Mar 2009 12:49:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a12g2000yqm.googlegroups.com; posting-host=20.133.0.8; posting-account=g4n69woAAACHKbpceNrvOhHWViIbdQ9G User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:4254 Date: 2009-03-24T05:49:11-07:00 List-Id: On 24 Mar, 10:55, reinkor wrote: > On 24 Mar, 11:07, Martin wrote: > > > > > > > > > On 24 Mar, 08:51, reinkor wrote: > > > > What is the "natural"/best way to make an Ada program > > > treat time/calendar data in UTC ? =A0The quetion is about > > > treating old measurements/data tagged with UTC time. > > > > I use > > > > =A0 Offset : Constant Time_Offset :=3D UTC_Time_Offset; > > > > and include "Time_Zone=3D>Offset" in calendar routines > > > (for example in the functions Time_Of, Split, Value > > > within =A0the packages Ada.Calendar.Formatting and > > > Ada.Calendar.Time_Zones). > > > > I find this a but "artificial". How should one do it? > > > > reinert > > > Dmitry raises some issue which I'm sure the ARG are looking at but you > > _might_ be perfectly ok if all you're doing reading log files, etc and > > not actually trying to combine this with a clock your program is > > reading and expecting them to tie together with the time on your wrist > > watch. And if your log didn't come from a run over summer-time > > changes, leap seconds etc on an OS that actually dealt with such > > things. > > > Cheers > > -- Martin > > So you say that if I make sure nobody runs my program code > on an advanced computer over summer-time changes, leap seconds etc > - my program may go correct ? Without know what you're doing it's hard to say. If you're just using UTC as a timetag then absolutely you should be ok. The problems are when the 'real world' goes and changes what 'time' is - e.g. clocks going forward and backwards, inserting leap seconds. These sort of things make sensible time computations hard, e.g. what does "1:30am" mean if the clocks have gone back an hour for winter at 2am? Is it the first 1:30am or the second that night? (can't remember if it 2am->1am or 3am->2am or something else but you get the idea). Also leap seconds are interested into OS tables 'retrospectively' - if you are interested in the difference between to time and need seconds or better accuracy you again could be in trouble. Do you know your OS accounts for leap-seconds? If so, do you know if the leap seconds table is up-to-date? Cheers -- Martin