comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
Subject: Re: Timetype
Date: Thu, 27 Jun 2002 16:03:14 -0500
Date: 2002-06-27T16:03:14-05:00	[thread overview]
Message-ID: <mailman.1025211842.28308.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 7CKS8.3774$t4.9720@nntpserver.swip.net


----- Original Message -----
From: "Bj�rn Lundin" <bjorn.lundin@swipnet.se>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: Thursday, June 27, 2002 3:31 PM
Subject: Timetype


>
> Hello1
> Can anyone explain this to me?
>
> cut from a-calend.ads
> --  Declarations representing limits of allowed local time values. Note
that
> --  these do NOT constrain the possible stored values of time which may
well
> --  permit a larger range of times (this is explicitly allowed in Ada 95).
>
>    subtype Year_Number  is Integer range 1901 .. 2099;
>
>
> Does it mean that i can write an application dealing with historical dates
> using the time_type?
>
Not exactly.  The problem would be with the Split and Time_Of subprograms,
not with the representation of values of type Time.

> It seems to me that a date like 05-Jun-1712 would cause
> constraint_error.
That's correct, as far as the use of the aforementioned subprograms is
concerned.
>
> Does anyone know the reason for this small range of years in
> the timetype?

The Year_Number range of 1901 .. 2099 was deliberately chosen so that
implementations
could use the simple rule that if (Year mod 4) = 0 then the year is a leap
year.

I.e., it does not have to deal with the more complex rule that
is_Leap_Year := (Year mod 4) = 0 and then
((Year mod 100) /= 0 or else (Year mod 400) = 0);
to say nothing about the dates on which various countries switched from the
Julian to the
Gegorian calendar.

There is also the complication that on UNIX systems, the range of time
representable in
a 32-bit integer extends only from December 13, 1901 through January 18,
2038.

>
> /Bj�rn
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>




  reply	other threads:[~2002-06-27 21:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-27 20:31 Timetype Björn Lundin
2002-06-27 21:03 ` David C. Hoos [this message]
2002-06-28  5:26 ` Timetype Mark Biggar
2002-06-28 13:47   ` Timetype Marin David Condic
2002-06-28 17:12   ` Timetype Björn Lundin
2002-06-28 23:51   ` Timetype Robert C. Leif
2002-06-28 12:53 ` Timetype Jacob Sparre Andersen
replies disabled

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