comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst@cts.com>
Subject: Re: Y21C Bug
Date: 2000/01/04
Date: 2000-01-04T00:00:00+00:00	[thread overview]
Message-ID: <yecd7rh8th5.fsf@king.cts.com> (raw)
In-Reply-To: 387246D7.8B1B2E8B@earthlink.net

Charles Hixson <charleshixsn@earthlink.net> writes:
[...]
> With 64 bit numbers available, I propose a new time standard, based
> around 64-bit floats.  We need a SMALL floating number (16 bits?) to
> specify the millennium, and a large floating number (64 bits) to
> specify the time.  (0 = center of the millennium, +- 1 = +- 500
> years, etc.).  Current Millennium = 2 (years 2,000->2,999, CE).  (I
> allow for a year 0 before the year 1, if you wish to print that out
> as 1 BC, that's merely a formatting issue.)
> 
> This would let us be as accurate as we have data available almost
> all the time (i.e, creation of universe to end of universe [note:
> the millennium was a floating point number]).

Huh?

I don't think that floating-point is appropriate for a time standard.
The precision is too strongly dependent on how far you are from the
arbitrarily chosen epoch.  Floating-point arithmetic is notoriously
tricky, which could be a serious problem if you want to check
timestamps for equality, or reliably determine which of two files is
newer.  I also don't see the point of separating the millennium into a
separate field, or even explicitly representing it.

For 1-second precision, a signed 64-bit time_t orginating at Jan 1,
1970 can represent times nearly 300 billion years into the past and
future.  If one second is too coarse, a second 64-bit word can give
you a precision of about 54 zeptoseconds (zepto means 10**(-21)).  In
Ada terms, this would be a 128-bit fixed-point type with a 'Small of
2**(-64).  Conversion to and from a human-readable format is not
difficult.

In GNAT, I seem to recall that types Duration and Calendar.Time have
the same representation, a 64-bit fixed-point type with a 'Small of
1.0e-9.  That gives you nanosecond resolution over a range of times
from about 1677 to about 2262.  There are some fields for which that's
insufficient, but for most applications it's more than enough.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Welcome to the last year of the 20th century.




  reply	other threads:[~2000-01-04  0:00 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-02  0:00 Y21C Bug reason67
2000-01-02  0:00 ` Robert Dewar
2000-01-03  0:00   ` Tarjei T. Jensen
2000-01-03  0:00     ` Robert A Duff
2000-01-04  0:00       ` Tarjei T. Jensen
2000-01-04  0:00         ` Robert A Duff
2000-01-04  0:00         ` Samuel Tardieu
2000-01-04  0:00         ` Robert Dewar
2000-01-05  0:00           ` Tarjei T. Jensen
2000-01-05  0:00             ` Al Christians
2000-01-06  0:00               ` Robert Dewar
2000-01-06  0:00               ` Tarjei T. Jensen
2000-01-06  0:00                 ` Robert Dewar
2000-01-06  0:00                   ` Robert A Duff
2000-01-06  0:00                     ` Larry Kilgallen
2000-01-07  0:00                     ` Florian Weimer
2000-01-07  0:00                       ` Robert A Duff
2000-01-07  0:00                         ` Robert Dewar
2000-02-04  0:00                           ` Florian Weimer
2000-02-04  0:00                             ` Robert A Duff
2000-02-04  0:00                               ` Florian Weimer
2000-01-11  0:00                         ` Mats Weber
2000-01-11  0:00                           ` Robert A Duff
2000-01-12  0:00                             ` Mats Weber
2000-01-12  0:00                               ` Thierry Lelegard
2000-01-13  0:00                                 ` Mats Weber
2000-01-13  0:00                                 ` Robert A Duff
2000-01-13  0:00                                   ` Thierry Lelegard
2000-01-13  0:00                                   ` Larry Kilgallen
     [not found]                               ` <387dfb1e.cbbf14c7@mail.com>
2000-01-13  0:00                                 ` Larry Kilgallen
2000-01-11  0:00                     ` Mats Weber
2000-01-07  0:00                   ` Tarjei T. Jensen
2000-01-07  0:00                     ` Robert Dewar
2000-01-05  0:00             ` Robert Dewar
2000-01-06  0:00               ` Richard D Riehle
2000-01-06  0:00               ` Tarjei T. Jensen
2000-01-06  0:00                 ` Larry Kilgallen
2000-01-06  0:00               ` Georg Bauhaus
2000-01-06  0:00                 ` Tarjei T. Jensen
2000-01-04  0:00       ` Robert Dewar
2000-01-04  0:00         ` Charles Hixson
2000-01-04  0:00           ` Keith Thompson [this message]
2000-01-05  0:00           ` Robert Dewar
2000-01-05  0:00             ` Y21C Bug :-) Charles Hixson
2000-01-06  0:00               ` Ted Dennison
2000-01-07  0:00                 ` Keith Thompson
2000-01-07  0:00                   ` Robert A Duff
2000-01-05  0:00           ` Y21C Bug Robert Dewar
2000-01-03  0:00     ` Jeff Creem
2000-01-03  0:00       ` Tarjei T. Jensen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox