Simulator All dates in UTC

The overflow lab.

An exact integer, a finite register, and two different readings of the same seconds.

32 bits / 4 bytes

Signed 32-bit time

Within signed 32-bit range
32-bit memorySign bit   /   31 value bits

Stored signed 32-bit value
2,147,483,647
Requested date
32-bit interpreted date

Both representations preserve these seconds. The leading bit determines the sign of the 32-bit value.

Same seconds, stored in 64 bits2,147,483,647
190119702038

Two's-complement wrap model, not a prediction for every system.Explore the fix

Why does 1901 appear?

The final positive value has a leading zero followed by 31 ones. Adding one produces a leading one followed by 31 zeros. In signed two's-complement form, that pattern represents -2,147,483,648.

Interpreted as seconds before the epoch, it becomes 1901-12-13 20:45:52 UTC.

The limits of this model

This experiment explicitly keeps the low 32 bits. Actual signed overflow in languages such as C can have undefined behavior; date APIs may instead return errors.

Requested seconds are exact signed 64-bit integers. The date display is limited to the JavaScript calendar range. Leap seconds are not modeled.

GNU timestamp boundary documentation