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-7-bit Path: g2news1.google.com!news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!cyclone1.gnilink.net!gnilink.net!wns14feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Newbie Q: How to program in UTC (time/calendar) ? References: <7f003dc4-3c3c-4e47-8ddf-d5001b310c17@g38g2000yqd.googlegroups.com> <8ba0ccec-1b4a-4908-bfa3-1af471aa1798@e21g2000yqb.googlegroups.com> In-Reply-To: <8ba0ccec-1b4a-4908-bfa3-1af471aa1798@e21g2000yqb.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 173.16.158.68 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1238431637 173.16.158.68 (Mon, 30 Mar 2009 16:47:17 GMT) NNTP-Posting-Date: Mon, 30 Mar 2009 16:47:17 GMT Organization: AT&T ASP.att.net Date: Mon, 30 Mar 2009 16:47:17 GMT Xref: g2news1.google.com comp.lang.ada:4387 Date: 2009-03-30T16:47:17+00:00 List-Id: reinkor wrote: > > Time1 := Value("1970-01-01 00:00:00",Time_Zone => UTC_Time_Offset); > > gives UTC for the local "input" time "1970-01-01 00:00:00" ? No, as I understand it, this gives the system time equivalent of 1970-01-01 00:00:00 in a location where the local time offset is UTC_Time_Offset at that time. Note that UTC_Time_Offset is the current offset for the system; it may be different from the system's offset at the given time. > How do I best "input"/enter UTC time (so a reader of the program also > understand it - an independent of the computer local time)? If I understand your problem correctly, you only want to input and output UTC times, and perform basic arithmetic on them. You never want to mix UTC with local/zoned times. I'd probably limit myself to the operations in Ada.Calendar. You'll need to create your own Image and Value operations (PragmARC.Date_Handler may be helpful for that). The operations in Ada.Calendar (except Clock) are ignorant of time zones, and so will give you meaningful values. If you need to mix UTC with time zones then things get more complicated. The PragmARCs are at http://pragmada.home.mchsi.com/ -- Jeff Carter "I don't know why I ever come in here. The flies get the best of everything." Never Give a Sucker an Even Break 102