comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <nickroberts@adaos.worldonline.co.uk>
Subject: Re: Ada, calendar, and daylight savings
Date: Tue, 30 Oct 2001 02:19:51 -0000
Date: 2001-10-30T02:19:51+00:00	[thread overview]
Message-ID: <9rl2s2$u9eai$1@ID-25716.news.dfncis.de> (raw)
In-Reply-To: 3BDD94E6.2030804@acm.org

My suggestion is as follows:

package Ada.Calendar.Worldwide is

   type Zoned_Time is private;
   -- This type includes the offset from UTC with the actual time.

   type Time_Zone_Offset is delta 30*60.0 range -12*60*60.0 .. +12*60*60.0;
   -- An offset from UTC, in seconds, as half-hour intervals from -12 to
   -- +12 hours. Localtime = TimeUTC + offset.

   function Clock return Zoned_Time;
   -- Also concurrently ascertains the local offset from UTC.

   function Local_Time (Zoned: Zoned_Time) return Time;
   -- Returns the local time from a Zoned_Time.

   function Time_UTC (Zoned: Zoned_Time) return Time;
   -- Returns the time UTC from a Zoned_Time.

   function Difference_from_UTC (Zoned: Zoned_Time) return Time_Zone_Offset;
   -- Returns the offset from UTC for a Zoned_Time.

   function Current_Difference_from_UTC return Time_Zone_Offset;
   -- Returns the offset from UTC currently set. Could change at any time.

   function To_Zoned (Date:       Time;
                      Difference: Time_Zone_Offset := 0.0)
      return Zoned_Time;

private
   ... -- implementation defined
end Ada.Calendar.Worldwide;

I think this should go into an optional Annex.

I'd like to see the range of Day_Duration extended:

   subtype Day_Duration  is Duration range 0.0 .. 86_405.0;

in Ada.Calendar in the next revision, to allow for added leap seconds.

--
Nick Roberts


"Corey Minyard" <minyard@acm.org> wrote in message
news:3BDD94E6.2030804@acm.org...
> Marin David Condic wrote:
> ...
> I'm not saying that it needs to use UTC for implementation, but I think
> it at least needs an annex to be able to coordinate time in some way.
> And if it uses daylight savings and timezones, the program needs some
> way to get that information and do translations into different timezones.
>
> > Better that a more sophisticated time package be included as some kind
of
> > annex or optional package. That's why I suggested that it might make a
good
> > candidate for a standard component library.
>
> I'm already working on it.  I was just wondering how it should interact
> with Ada.Calendar, and I think I know now.






  reply	other threads:[~2001-10-30  2:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-28 23:41 Ada, calendar, and daylight savings Corey Minyard
2001-10-28 23:53 ` Larry Kilgallen
2001-10-29  3:44   ` Corey Minyard
2001-10-29 10:17     ` Larry Kilgallen
2001-10-29 14:02       ` Corey Minyard
2001-10-29 14:35     ` Marin David Condic
2001-10-29  2:34 ` Steven Deller
2001-10-29  3:51   ` tmoran
2001-10-29  5:53     ` Corey Minyard
2001-10-29  6:49       ` tmoran
2001-10-29 10:21       ` Larry Kilgallen
2001-10-29 14:18         ` Corey Minyard
2001-10-29 23:15           ` tmoran
2001-10-30  2:07             ` Corey Minyard
2001-10-30  3:11               ` tmoran
2001-11-01  0:13                 ` Al Christians
2001-10-30 12:29               ` Larry Kilgallen
2001-10-29 14:48       ` Marin David Condic
2001-10-29 17:41         ` Corey Minyard
2001-10-30  2:19           ` Nick Roberts [this message]
2001-10-30  5:41             ` Al Christians
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox