[tz] tzfiles contain Unix epoch for the first transition time

Robert Elz kre at munnari.OZ.AU
Sat Aug 15 01:36:28 UTC 2015

    Date:        Fri, 14 Aug 2015 19:16:29 +0000
    From:        Eric Erhardt <Eric.Erhardt at microsoft.com>
    Message-ID:  <CY1PR0301MB153029A652C0DE9D9D21B86B8E7C0 at CY1PR0301MB1530.namprd03.prod.outlook.com>

  | the "big bang" transition that didn't appear in the older tz files

No, it is relatively new.

  | This time value isn't possible to represent in .NET

No, it is way too far back in time for that representation.

But ...
  | (since DateTime.MinValue is 00:00:00.0000000 UTC, January 1, 0001,

That's not really the reason - again, a very rough calculation (and assuming
I did it correctly) means that the format you described should be able to
represent +/- (almost) 30,000 years from the epoch - that's something more
that 27000 BC.

The only reason I can see for picking that particular minimum value is
that it means avoiding the question of what year came before year 1
(some say it was 1 BC, and there was no year 0, others disagree - there
is of course no correct answer, as back then years weren't counted this
way, and even if they had been, no-one then would have considered the year
we now call year 1 as being in any way significant enough to warrant starting
counting from then.)

It also means avoiding the question of how to represent negative years.
I just tried it on my NetBSD system, and managed to get ...

Sat May 19 01:22:04 LMT -7537

(that was from "date -r -300000000000" - the -r option on NetBSD allows
providing the time_t value to use, rather than getting it from the clock,
a linux-like -d also exists, but the formats for that are just too weird).

I have no idea if that -7537 is 7537 BC or 7538 BC (ie: whether it is
assumed that there was a year 0 or not).  I suspect that this all happens
just by accident, and no-one really ever considered the possibility of
negative years - it is only since time_t's became 64 bits (the last few
years) that it even became possible, before then the range was about 

Simply claiming that years before year 1 don't exist avoids both
problems, so it is kind of an elegant solution.

  | in the Gregorian calendar).

We all do it, but of course, there was no Gregorian calendar then, Pope
Gregory didn't exist yet, nor did his great-great-great grandparents.
Nor were there even any popes, the job hadn't been invented yet...

  | 1. I shouldn't be checking explicitly for this value (0xf800000000000000),
  | right?  I saw some code comments in zic.c that says it could potentially
  | change in the future.

Just check for values too small (or large) to represent in the format
you're using.   That one is a LONG way out of that range.

  | 2. Will there ever be more than one transition time that is before
  | January 1, 0001?  Or will the "big bang" transition be the only one?

It is kind of unlikely - it's hard getting people to actually include
transitions before 1970 .. but back then there was no standard time
(no railways, planes, or computer networks that need consistent timekeeping)
so it is hard to imagine a reason for anything before about the 16th
century ever being meaningful enough to include.


More information about the tz mailing list