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.0 required=5.0 tests=BAYES_00,DATE_IN_PAST_24_48, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,59c3b3f9911c9191 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.228.227 with SMTP id sl3mr400655pbc.5.1343314853633; Thu, 26 Jul 2012 08:00:53 -0700 (PDT) Path: p10ni64932187pbh.1!nntp.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news-out.octanews.net!mauve.octanews.net!newspump.sol.net!xlned.com!feeder5.xlned.com!feed.xsnews.nl!border-1.ams.xsnews.nl!newsfeed.straub-nv.de!nuzba.szn.dk!pnx.dk!zen.net.uk!dedekind.zen.co.uk!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada.Calendar and NTP (and Unix Epoch) Date: Tue, 24 Jul 2012 20:28:27 +0200 Organization: cbb software GmbH Message-ID: References: <500dc548$0$2936$f40e02c5@shockwave.dk.telia.net> <18893cca-baa2-4930-bfb4-4c4f7eb7e983@googlegroups.com> <60c9c92b-280b-4178-a410-2bc8756c6b5e@googlegroups.com> <5513b36d-560f-42ee-b6b6-bdb456097780@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 9A8bJrx4NhDLcSmbrb6AdA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-07-24T20:28:27+02:00 List-Id: On Tue, 24 Jul 2012 09:26:46 -0700 (PDT), Adam Beneschan wrote: > Now, use Ada.Calendar.Time_Of to create a Time T_Base representing 1/1/1901. > Or, better, if the NTP time is always UTC, then you should probably use > Ada.Calendar.Formatting.Time_Of to create a time that represents midnight > of 1/1/1901 in UTC time; I think you do this by passing Time_Zone => > Ada.Calendar.Time_Zones.UTC_Time_Offset. (Somebody please correct me if > I'm supposed to negate the value.) There is no simple way of converting Ada.Calendar.Time to UTC. At least there was none in Ada 2005. I think Randy Brukardt wanted to fix that, or sort of. The problem is that UTC_Time_Offset has time argument. It is not constant. UTC_Time_Offset jumps forth and back together with the political time. Furthermore, operations like UTC_Time_Offset, Time_Of, Split for some distant time in the past, e.g. 1901 are most likely wrong, because OS/Ada's RTL cannot keep track of all political changes of all time zones in order to be able to evaluate the number of seconds from present time to 1901 in the time zone. It is *not* the number of years multiplied by the year's duration. (IANA Time Zone Database or alike is required for that) Calculating future times is absolutely impossible because that depends on future decisions of the corresponding governmental bodies having the authority over the time zone, from daylight saving time to changing the whole zone. This is why it is better not to touch Ada.Calendar.Time. Ada.Real_Time, Duration, Time_Span, some numeric type would be much better candidates. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de