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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2b151131f90050ab,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-28 15:41:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!nntpserver.com!hub1.nntpserver.com!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news2.rdc2.tx.home.com.POSTED!not-for-mail Message-ID: <3BDC97CE.8070304@acm.org> From: Corey Minyard User-Agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.5+) Gecko/20011012 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Ada, calendar, and daylight savings Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 28 Oct 2001 23:41:28 GMT NNTP-Posting-Host: 24.7.109.109 X-Complaints-To: abuse@home.net X-Trace: news2.rdc2.tx.home.com 1004312488 24.7.109.109 (Sun, 28 Oct 2001 15:41:28 PST) NNTP-Posting-Date: Sun, 28 Oct 2001 15:41:28 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:15316 Date: 2001-10-28T23:41:28+00:00 List-Id: I've been looking at calendar issues in Ada, I'm trying to write a complete calendar package for Ada. I'm trying to understand how daylight savings works in Ada.Calendar. An average day has 86_400 seconds (24 * 3600). However, the day where daylight savings time is activated would seem to have 82_800 seconds (23 * 3600) and the day where daylight savings time is deactivated, as just happened in the US, would seem to have 90_000 seconds (25 * 3600). I would seem to me that the seconds in the day would not be dependent on daylight savings, but would instead range 0 .. 90_000. Otherwise, certain times cannot be represented properly in certain circumstances. For instance, if you do the following: with Ada.Text_IO; use Ada.Text_IO; with Ada.Calendar; use Ada.Calendar; procedure T1 is Time1 : Time; Time2 : Time; Year1 : Year_Number; Month1 : Month_Number; Day1 : Day_Number; Seconds : Duration; begin Time1 := Time_Of(2001, 10, 28, 3600.0 * 1.5) + 3600.0; Split(Time1, Year1, Month1, Day1, Seconds); Time2 := Time_Of(Year1, Month1, Day1, Seconds); if (Time1 = Time2) then Put_Line("Times are equal"); else Put_Line("Times are unequal"); end if; end T1; The times will not be equal (at least on GNAT-3.12p in a US timezone). Is this the intent? If so, there is no easy way to tell the two "1:30AM" times apart from each other, because the calendar package gives no way to tell if DST is active. I guess you could figure out of DST might active on that day and add an hour to see if you get the same "seconds" value back, but that's kind of a pain. I guess I'm used to the Java calendar package, which is quite powerful and comples. The whole date/time things is a big mess, anyway. Thanks for any insight on this. -Corey