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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.94.240 with SMTP id df16mr11821522obb.17.1437066440839; Thu, 16 Jul 2015 10:07:20 -0700 (PDT) X-Received: by 10.140.106.247 with SMTP id e110mr243408qgf.7.1437066440737; Thu, 16 Jul 2015 10:07:20 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!qs7no6325953igc.0!news-out.google.com!4ni81364qgh.1!nntp.google.com!z61no1462142qge.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 16 Jul 2015 10:07:20 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=50.111.126.201; posting-account=Ies7ywoAAACcdHZMiIRy0M84lcJvfxwg NNTP-Posting-Host: 50.111.126.201 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Time_Zone-aware Day_of_Week ? From: brbarkstrom@gmail.com Injection-Date: Thu, 16 Jul 2015 17:07:20 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:26824 Date: 2015-07-16T10:07:20-07:00 List-Id: On Monday, July 13, 2015 at 12:45:48 PM UTC-4, Jeffrey R. Carter wrote: > On 07/13/2015 06:26 AM, Natasha Kerensikova wrote: > > > > Moreover, the description in the ARM of the function is quite terse: > > "Returns the day of the week for Time. This is based on the Year, Month, > > and Day values of Time." > > Presumably the Year, Month, and Day returned by Ada.Calendar.Split. > > > However, all of Year, Month and Day functions do have the Time_Zone > > argument that Day_of_Week lacks. So which time offset is Day_of_Week > > supposed to use? > > I'd guess the time offset given by Ada.Calendar.Time_Zones.UTC_Time_Offset. > > PragmARC.Date_Handler.Day_Of_Week gives you the day of week of any Year, Month, > and Day CE you care to give it, even for values of Year outside > Ada.Calendar.Year_Number. It can also give you the day of week for any > Ada.Calendar.Time, using the Year, Month, and Day returned by Ada.Calendar.Split. > > The PragmAda Reusable Components are at > > https://pragmada.x10hosting.com/pragmarc.htm > > -- > Jeff Carter > "He that hath no beard is less than a man." > Much Ado About Nothing > 132 Depending on the precision you need, it might be worth thinking about the difference between Civil Time (which uses Year, Month, Day, Hour, Minute, and Second) and International Atomic Time (TAI - due to French Standards). TAI tracks seconds and is directly related to GPS Time and one or two other variants. The standard reference for these different time systems is Seidelmann, P. K., 2006: Explanatory Supplement to the Astronomical Almanac, University Science Books, Sausalito, CA. If you need to calculate time differences frequently and want to avoid the unpleasantries of having to deal with errors associated with time zone inputs (or lack thereof), TAI is probably preferable. This may be important for Fourier analysis of time series, where the incomensurability of Civil Time can introduces errors into the frequency spectrum derived from the data. One satellite mission had to expend a great deal of effort to find that the lack of a common time basis caused some serious errors in their measurements of the Earth's reflection. Bruce B.