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

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



Ray Dillinger scripsit:

> This is the standard used for astronomical timekeeping; These days 
> are as perfectly synchronized to the rotation of the earth as 
> astronomical observations can make them. 

That turns out to be microseconds in the present state of the art,
according to the WP article on Universal Time.

> If you want a simple date format that allows days and fractions-of-
> days etc to be added, subtracted, worked with, etc, as calendrical 
> time, the Julian Day Number is the single obvious choice.  

The problem here is that the remote epoch, the current standard of
timekeeping, and the available size of floating-point numbers form a
toxic trio.  Currently, the integer part of the JDN takes 7 digits,
and it takes about 11 digits to represent the number of microseconds in
a day.  Unfortunately, IEEE 64-bit floats only provide a hair less than
16 digits, so they can't be used.  As the epoch recedes inexorably into
the past, and the standard of timekeeping improves almost as inexorably,
the problem will only get worse.  It'll be quite a while before 128-bit
floats are generally available, although IEEE 754:2008 specifies them,
and history shows that Schemes generally don't bother with more than one
precision of floating-point numbers.

There are a bunch of variants of the JDN with different epochs, like the
Modified JDN, whose epoch is November 18, 1858 Gregorian at midnight
UT, but they only postpone the evil day.  So we are stuck with either
representing current calendrical time in a complex fashion (e.g. the
integer Julian Day plus a floating-point fraction greater than or equal
to zero and less than 1, which at least puts the high-precision part
of the scale in the present, not the remote past where it is useless),
or simply ruling out high-precision calendrical time from the system,
which is pretty much what Posix time does.

-- 
In my last lifetime,                            John Cowan
I believed in reincarnation;                    http://www.ccil.org/~cowan
in this lifetime,                               cowan@x
I don't.  --Thiagi

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