[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: John Cowan <cowan@x>*Subject*: Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme*From*: "Thomas Bushnell, BSG" <tb@x>*Date*: Mon, 29 Nov 2010 12:57:00 -0800*Cc*: discuss@x, scheme-reports@x, r6rsguy@x, scheme-reports-wg2@x*In-reply-to*: <20101129025908.GB22427@mercury.ccil.org>*References*: <20101122071505.GD10553@mercury.ccil.org> <201011260316.oAQ3Gw8I004406@fcs13.keithdiane.us> <20101126071633.GA2818@mercury.ccil.org> <2C2F5FE7-9AF0-4444-AECE-BDC3703513D7@iro.umontreal.ca> <20101127020054.GC2818@mercury.ccil.org> <6D1BF986-6039-46EE-8B57-F89EFCACF2F1@iro.umontreal.ca> <AANLkTikk4qbR-xDBBTKvxyrHOY042o5VtU8XXp+FPDiL@mail.gmail.com> <20101128170743.GB8401@mercury.ccil.org> <AANLkTi=+uSdqpWDe_RKqOWgh765JasW4XGXjebQ2gmfx@mail.gmail.com> <20101129025908.GB22427@mercury.ccil.org>

On Sun, Nov 28, 2010 at 6:59 PM, John Cowan <cowan@x> wrote:

Thomas Bushnell, BSG scripsit:

Not at all. My proposal allows instants to be either exact or inexact

> 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.

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.

Scaling is good: it says how much "1" is. But it has nothing to do with "resolution".

Stop thinking about "integers". Integers are irrelevant; these are *real numbers *and the fact that some of them are integers is irrelevant.

If the interface says "number of seconds since the epoch, not counting leap seconds" (which is what Posix's gettimeofday is), then let it be that. "Add 1" to the value means "add one second". The precision is about the precision of the particular numeric representation. The accuracy is a question of the system clock underneath, which is interesting to know but not determinable with Posix.

So the interface should return seconds (naturally, since that's what Posix thinks in), and should promise to return a real number.

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.

Remember to separate the exactness of a numeric representation from the accuracy of the underlying clock. If the accuracy is 10ms (typical for lots of systems), then that does not mean it's pointless for the numeric representation to be exact. So I agree that there should be no recommendation about what sort of numeric format to use. Keep in mind that "inexact rational" does not mean "floating point" in Scheme.

Most clocks don't know their accuracy at all, never mind knowing their

accuracy accurately.

I think we should have a interface for it, but alas, Linux and Posix don't provide a way to get it. Given NTP and the granularity of clock interrupts, the accuracy is known in some sense to the system as a whole, but in practice difficult to determine.

Thomas

_______________________________________________ Scheme-reports mailing list Scheme-reports@x http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

**Follow-Ups**:**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme***From:*John Cowan <cowan@x>

**References**:**[Scheme-reports] Date and time arithmetic library proposal for R7RS large Scheme***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme***From:*r6rsguy@x

**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme***From:*Marc Feeley <feeley@x>

**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme***From:*Marc Feeley <feeley@x>

**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme***From:*"Thomas Bushnell, BSG" <tb@x>

**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme***From:*John Cowan <cowan@x>

**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme***From:*"Thomas Bushnell, BSG" <tb@x>

**Re: [r6rs-discuss] [Scheme-reports] Date and time arithmetic library proposal for R7RS large Scheme***From:*John Cowan <cowan@x>

- Prev by Date:
**Re: [r6rs-discuss] [Scheme-reports] Date and time arithmetic library proposal for R7RS large Scheme** - Next by Date:
**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme** - Previous by thread:
**Re: [r6rs-discuss] [Scheme-reports] Date and time arithmetic library proposal for R7RS large Scheme** - Next by thread:
**Re: [Scheme-reports] [r6rs-discuss] Date and time arithmetic library proposal for R7RS large Scheme** - Index(es):