[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [r6rs-discuss] [Scheme-reports] Date and time arithmetic library proposal for R7RS large Scheme
Thomas Bushnell, BSG scripsit:
> So what I heard was that you wanted to represent an instant of time as
> an integer, with some determinate resolution, and then the predictable
> fight about whether the integer should be denominated in milliseconds,
> microseconds, or nanoseconds.
Not at all. My proposal allows instants to be either exact or inexact
rationals. The question is, if you add 1 to a instant, do you get an
instant one second later (modulo leap seconds), or 1 ms later, or what?
This is neither accuracy, precision, nor resolution, but a fourth notion
which I will call scaling. When instants are integers, scaling and
resolution are the same thing, but not so when instants are allowed to
be non-integers.
I originally proposed that the scaling be 1 ms; that is, that adding 1
to an instant gets you an instant 1 ms later. However, it seems that
enough people find that confusing that I've now switched to a scaling
of 1 s; that is, adding 1 to an instant gets you an instant representing
the next second.
Marc Feeley's arguments persuaded me to require inexact rationals as
the representation of instants. However, in practice these are 64-bit
floats, which means since the resolution varies with the distance of
the instant from the epoch, we currently (41 years after the epoch) can
get approximately 10^-5 resolution at best if an instant is a 64-bit
float, and it will get worse as time goes on. So I have removed the
recommendation to use inexact numbers.
> An instant should be a *number *without any mandated statement of just
> what kind of number it is. And, as I said, an interface that answers
> questions like "what time is it now" has an accuracy as well, which
> should be returned (and which is *not* the same thing as the precision
> of some determinate resolution). There is no worry about precision at
> all if you just return a number, and an accuracy value.
Most clocks don't know their accuracy at all, never mind knowing their
accuracy accurately.
> Posix decided that leap seconds were impossible, and now we have
> the confusing rule that the epoch changes every time a leap second is
> issued. Ah, well, but at this point we're stuck with that bad decision,
> and it would be best if Scheme conformed to it.
+1
> The separate question of what broken-out times
> should look like is one which I think we should handle by simply aping the
> Posix rules, which is pretty much what the proposal on the table looks like.
It's a mixture of Posix and ISO 8601.
--
Man has no body distinct from his soul, John Cowan
for that called body is a portion of the soul cowan@x
discerned by the five senses, http://www.ccil.org/~cowan
the chief inlets of the soul in this age. --William Blake
_______________________________________________
r6rs-discuss mailing list
r6rs-discuss@x
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss