Dumb questions about GMT offset in tm structure

Mark Horton seismo!cbpavo.MIS.OH.ATT.COM!mark
Sat Mar 21 15:11:29 UTC 1987


Here's a wild idea:

If the two high order bits of a time_t are 11, the rest of the bits
are taken as a number of days since some early epoch, perhaps 1858
or something in that general ballpark.  (1900 isn't quite early
enough for our application.)  Actually, a quick calculation shows
that this allows for nearly 3 million years, so we could easily
adopt the year 0 AD as the epoch.

The disadvantage to this is that time_t is no longer a simple
arithmetic type, although any application that knows it's dealing
with timestamps can still assume it is.  Only the canned routines
like ctime need to know about it.

Another disadvantage is that time_t used as a timestamp now only
extends to about 2071.  By using more than 2 bits as a flag, this
could be extended.  For example, if the flag were that all 8 high
bits are 11111111, it covers 46,000 years, still plenty.  It
could even be a signed quantity, allowing years from 23,000 BC to
23,000 AD.  This only loses 194 days from the end of the range
in 2106.

	Mark



More information about the tz mailing list