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,cb2591a9113d8ee6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!news-east.rr.com!news.rr.com!news-server.columbus.rr.com!cyclone2.kc.rr.com!news2.kc.rr.com!tornado.socal.rr.com.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Advice on Calendar.Time References: <1131465873.702910.143400@g43g2000cwa.googlegroups.com> From: Keith Thompson Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:KMu8Q0ASvwUmRX+yhWnwCK8ZDlo= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 09 Nov 2005 01:36:59 GMT NNTP-Posting-Host: 66.75.136.120 X-Complaints-To: abuse@rr.com X-Trace: tornado.socal.rr.com 1131500219 66.75.136.120 (Tue, 08 Nov 2005 17:36:59 PST) NNTP-Posting-Date: Tue, 08 Nov 2005 17:36:59 PST Organization: Road Runner High Speed Online http://www.rr.com Xref: g2news1.google.com comp.lang.ada:6307 Date: 2005-11-09T01:36:59+00:00 List-Id: Kilgallen@SpamCop.net (Larry Kilgallen) writes: > In article <1131465873.702910.143400@g43g2000cwa.googlegroups.com>, > "REH" writes: >> Ok, I have another problem: >> >> We have functions that convert between our mission time and >> Ada.Calendar.Time. The current implementation depends on the internal >> representation of Time. This is a pain because it must be rewritten >> everytime we move to a new compile (or even a new version of the same). >> Is there a way to do this in Standard Ada? Our mission time is the >> number of seconds since an arbitrarily choosen epoch (1/1/1998) GMT. >> We originally used Time_Of, but had problems because Time_Of was using >> local time and did DST adjustments which were undesirable. > > function Time_Of > (Year : Year_Number; > Month : Month_Number; > Day : Day_Number; > Seconds : Day_Duration := 0.0) > return Time; > > I don't see how Time_Of would be "using" some daylight savings time > algorithm unless that is what you fed it. The time base associated with type Ada.Calendar.Time is implementation defined; it's typically local time (however that's defined by the system). A note in the AARM even mentions the "missing hour" that occurs when DST starts in the spring. It's unfortunate, IMHO, that the standard doesn't explicitly support both local time and UTC. > If your operating system is set to make daylight savings time adjustments, > you should change that setting. That might be acceptable for an embedded system. If it's a user-oriented OS (like, say, Unix or Windows), making the system clock incorrect by an hour for half of each year would be a very bad idea. On some systems, time zone information has a default system-wide value, but can be changed for individual processes. Setting the $TZ environment variable to "UTC" certainly isn't portable, but it might be good enough for the OP's purposes. -- Keith Thompson (The_Other_Keith) kst-u@mib.org San Diego Supercomputer Center <*> We must do something. This is something. Therefore, we must do this.