Time library design proposal
Scott Turner
p.turner at computer.org
Wed Feb 2 01:17:42 EST 2005
On 2005 February 01 Tuesday 22:15, Ashley Yakeley wrote:
> Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote:
> > And there are contexts where you want a weekday and hour/minute but
> > not a month or second (a weekly schedule), contexts where you want
> > month/day but not a year (a holiday with a fixed date) etc. Where
> > to stop?
>
> Perl's DateTime has an "Incomplete" class for representing incompletely
> specified times.
If there were types for various intervals of time, as Ben Rudiak-Gould wrote:
> newtype AbsPicoseconds = AbsPicoseconds Integer
> newtype AbsSeconds = AbsSeconds Integer
> newtype AbsDays = AbsDays Integer
and more
newtype AbsHours = AbsHours Integer
newtype AbsMonths = AbsMonths Integer
newtype AbsYears = AbsYears Integer
then an incomplete time would amount to a function from a less precise time
interval to a more precise time interval. Various types of incomplete time
fall right out.
This wouldn't handle the conversion between "local time", and time with a
specified zone.
More information about the Libraries
mailing list