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,335675a1cb969fdb X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news4.google.com!feeder.news-service.com!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada.Calendar.Time_Zones Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.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: <1rm26vi0mz4sv.1kfhdnswhcrqa.dlg@40tude.net> <3jxnfgd6m2ff.ca8crnn387m3.dlg@40tude.net> <61migfnkb0sm.8wytouvj8o4f.dlg@40tude.net> Date: Sat, 9 Aug 2008 10:04:45 +0200 Message-ID: <18iqoye18iuzu$.jz3bz3dssmhe.dlg@40tude.net> NNTP-Posting-Date: 09 Aug 2008 10:04:46 CEST NNTP-Posting-Host: 30068972.newsspool3.arcor-online.net X-Trace: DXC=c^_J@X4c2aUPU8j_I0DN6_McF=Q^Z^V3X4Fo<]lROoRQ4nDHegD_]RUo9=>o;e\`DW[6LHn;2LCV^[ On Fri, 8 Aug 2008 21:09:42 -0500, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > news:aht87sie2uac$.ke09vcui32dj.dlg@40tude.net... >> On Thu, 7 Aug 2008 17:47:41 -0500, Randy Brukardt wrote: >> >>> "Dmitry A. Kazakov" wrote in message >>> news:61migfnkb0sm.8wytouvj8o4f.dlg@40tude.net... >>> ... >>>> But all that stuff like Time_Of etc is not really needed with UTC_Time. >>>> The package should provide Clock, +, -, <, <=, >, >=: >>> >>> I don't see how that could work. How would you display or create a UTC >>> time? >> >> No problem: >> >> T : Ada.UTC_Time.Time := ...; >> P : Ada.Calendar.Time := To_Calendar_Time (T); >> >> P is the political time corresponding to T, it is well-defined for each T. >> P can be used in Ada.Calendar.Split to display T as: >> >> August 08, 2008 10:18 (Berlin time) >> >> When used in Ada.Calendar.Formatting.Split with >> >> Time_Zone => UTC_Time_Offset (T) >> >> the display could be: >> >> August 08, 2008 09:18 (UTC time) > > Sorry, this doesn't make any sense. Your original point, boiled down, is > that it is never safe to convert from political time to UTC (because of the > overlaps and holes). But then you go ahead and do exactly that. It is safe in this case because it uses an external zone offset. The conversion is unsafe when an attempt is made to determine the offset from the political time itself. That is inconsistent. But when the offset is determined by the UTC time, then everything is fine. > In any case, if you were willing to require that, the current specification > would work just fine for UTC time (because you could always get the UTC time > directly from the record). In which case there is no problem, so we don't > need an additional mechanism. Yes, this is what GNAT does, at least under Windows. My proposal would allow to have Ada.Calendar.Time really skewed as politicians always whished (:-)). E.g. T : Time := Time_Of (2008, 10, 28, 1.5*3600.0); -- 1h before the skew then T1 := T + 1.0*3600.0; -- 28.10.2008 02:30 before skew T2 := T + 2.0*3600.0; -- 28.10.2008 02:30 after skew T1 = T2 -- Political arithmetic! A time defined this way will still be convertible forth and back to UTC time, if you know the time offset. That is 1h for T1 and 2h for T2. ----------- But in any case, RM should clarify what it means under political time. I.e. whether T1 = T2 (= truly political time), or not (= hidden UTC time). -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de