Mar. 1st, 2007

zwol: stylized sketch of a face in profile (Default)

It's fairly well known that Unix counts time in seconds since 1970, and that this will overflow a 32-bit signed counter in January of 2038. But this is the twenty-first century! It is no longer silly to store time in a 64-bit signed counter! I have a computer that does just this, sitting in my campus office! ... Just when will that overflow, I wondered.

It won't tell me. gmtime(264 - 1) returns NULL.

One half-written bug report later (plus some incoherent ranting on IRC) it occurs to me to find out exactly where the cutoff is. One binary search after that ...

(gdb) p mid
$1 = 67767976233532799
(gdb) p *t
$2 = {tm_sec = 59, tm_min = 59, tm_hour = 23, tm_mday = 31, tm_mon = 11, 
      tm_year = 2147483647,  tm_wday = 3, tm_yday = 364, tm_isdst = 0,
      tm_gmtoff = 0, tm_zone = 0x2af47c6ffa34 "GMT"}

... Oh. Of course. The year counter's still 32 bits. Abandon bug report.

April 2017

S M T W T F S
      1
2345678
9101112131415
16171819 202122
23242526272829
30      

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 5th, 2026 08:35 pm
Powered by Dreamwidth Studios