(32-bit) Time is running out !

NTPd and 32-bit time_t module. NTPd will fail on 2038-01-19 at Pi am.
ntpd will fail on 2038-01-19

When I was compiling a new version of the ntpsec package that I use for my Stratum-2 NTP server, I noticed an interesting warning that is well known but I had never paid attention to:

WARNING: This system has a 32-bit time_t.

WARNING: Your ntpd will fail on 2038-01-19T03:14:07Z.

This is fairly easy to explain and has to do with how time is calculated. First we need to discuss integers. An integer in a programming sense is a whole number which can be either positive or negative. For example: 12345 is an integer as is -54321. Integer variables can be assigned a size which best suits the intended variable value(s) to optimize computing resources. An integer variable that is used to store both positive and negative values is known as a signed integer. Variables which will only store positive values are unsigned integers and as you will soon see, have double the maximum value of signed integers.

In the simplest sense, a 32-bit processor has a maximum size integer of 32 binary bits, minus one. Thus, (232 – 1) = 4294967295 which is the value upper limit for an unsigned 32-bit integer. If instead, you use a signed integer (i.e. one that can have both positive and negative values) your maximum value is cut in half since one of the bits becomes the sign bit. (231 – 1) = 2147483647.

Next we need to know about the Unix epoch. It was decided that modern computer time would begin at precisely 1970-01-01T00:00:00UTC. All time after this point is counted as the number of seconds past epoch. Yes, seconds!

Ok, so knowing the maximum number a 32-bit signed integer can store, we can determine the precise upper limit of time which just so happens to be … 2038-01-19T03:14:07UTC

This is not really cause for concern (for the most part) since you can cheat systems to “think” that the time is different from current. This kludge will help support systems which may not be patched (i.e. very old hardware used for nostalgia purposes). Just be aware that left un-patched, file-systems which employ 32-bit time may not function post 32-bit time.

Taken from Wikipedia:

At 03:33:20 UTC on Wednesday, 18 May 2033, the Unix time value will equal 2000000000 seconds.

At 03:14:08 UTC on Tuesday, 19 January 2038, 32-bit versions of the Unix time stamp will cease to work

At 15:30:08 UTC on Sunday, 4 December 292277026596 (LOL) 64-bit versions of the Unix time stamp cease to work

This entry was posted in General and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *