```On Wed, Jan 07, 2004 at 12:10:14PM +0900, Hal Fulton wrote:
> Strangely the math isn't making sense to me at the moment.
>
> A billion seconds should be very roughly thirty years.
> That's 10**9 or roughly 2**27. The epoch is 68 years long.
> Surely we're not storing it in 28 bits. Someone show me
> where I'm being stupid.

A 32-bit integer can hold 2**32 = 4,294,967,296 values.  In
the case of UNIX time_t, those values represent numbers of seconds;
4,294,967,296 seconds is 49,710.(2696)+ days or a bit over 136
years, so that's the size of the representable range.

Now, if a 32-bit integer is treated as unsigned, its values are
interpreted as the numbers 0 through 4,294,967,295, which would
make the representable range 1970 through 2106.  But, at least on
some platforms, time_t is treated as a signed value, meaning
it's interpreted as having a value between -2,147,483,648 and
2,147,483,647.  So the representable range stops at 2038, although
it does theoretically extend backward to 1902.  Even there, though,
most apps only allow positive values even though the value is signed,
so the only reliably representable values are between 1970 and 2038.
And the midpoint of that range is this Saturday.

-Mark

```