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

Re: [Scheme-reports] current-posix-second is a disastrous mistake



Taylor R Campbell scripsit:

> Systems that implement SECONDS-SINCE-UTC-EPOCH using a POSIX clock
> should document that users must be prepared to tolerate a clock in
> error by more than 1 SI second.

To say so would be disingenuous, since trying to implement SECONDS-SINCE-
UTC-EPOCH with a Posix clock alone means users must be prepared to
tolerate a clock in error by *any* number of SI seconds.  Better to
return #f and have done with it.

In short: We need two sources of current time, one that counts SI seconds
or fractions thereof with some epoch, and another that is relatable to
the Julian Day, a measure of calendrical time.

Posix time is readily available and convertible to calendrical time
at the expense of not counting in SI seconds.  Arbitrary-epoch time
is convertible to TAI if you know a single implementation-dependent
constant, and if the epoch is close to the present, it puts precision
in the peripresent where it's needed, not in the past where it usually
isn't.  That's why TimeCowan provides current-posix-second, which also
returns leap-second information if known, and current-jiffy, which
is a count of implementation-dependent fractions of a second since an
implementation-dependent epoch.

-- 
John Cowan    http://ccil.org/~cowan    cowan@x
Economists were put on this planet to make astrologers look good.
        --Leo McGarry

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