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

[MacPerl] Big Crunch == Big Bang (Was: gmtime(0) has a problem ?)



I wrote in the previous mail
> And the result was this!
>
>         gmtime(0) =    (16, 28, 21, 5, 1, 140, 0, 35, 0)
>         localtime(0) = (0, 0, 0, 1, 0, 4, 5, 0, 0)

  Come to think of it,  gmtime(0) on MacPerl, in a way, is returning the ver
y moment of Big Cunch!

At 09:02 96.04.04, John W. Baxter wrote:
> That code will work OK until 2/6/2040; 6:28:15


  This is what ctime(0xfffffff) or ctime(MAX_UINT) returns.  The result of g
mtime(0) was exactly a second after that.

> The Mac clock chip zeros at 6:28:16 that day.  The preferred Macintosh time
> routines, based on an 8-byte time built by the system from the 4-byte clock
> chip, keep running happily (range about 33,000 years each way from Jan 1,
> 1904).  Apple added those routines several years ago.

  That's the way to go but long of most C is not "long enough"....
  With respect to time, POSIX is even worse that Mac's Big Crunch, instead o
f Unsigned long time_t is long so even though its Epoch is much later than t
hat of Mac, its Big Crunch comes earlier at 2038....

  Anyhow, no matter when the Epoch is, gmtime(0) is supposed to return the d
ate of Epoch, not the End of Time....

Dan the "Time Traveller"