The Year 2038 problem (Y2K38) explained
Updated
At 03:14:07 UTC on Tuesday, 19 January 2038, the Unix timestamp will reach 2,147,483,647. That is the largest number a signed 32-bit integer can hold. Any system that still stores time that way will overflow one second later — and, depending on how it fails, may jump back to 1901, crash, or reject the date as invalid. This is the Year 2038 problem, sometimes written Y2K38.
Why the overflow happens
A signed 32-bit integer uses one bit for the sign and 31 bits for the value, so its range is −2,147,483,648 to +2,147,483,647. For decades the C type time_t — the standard way to store a Unix timestamp — was a signed 32-bit integer on most platforms. Counting seconds from 1970, that range covers:
| Value | Moment (UTC) |
|---|---|
| −2,147,483,648 | 1901-12-13 20:45:52 |
| 0 | 1970-01-01 00:00:00 |
| 2,147,483,647 | 2038-01-19 03:14:07 |
Adding one to the maximum value “wraps around” to the minimum in two’s-complement arithmetic, so a naive 32-bit clock would go straight from 19 January 2038 to 13 December 1901.
It’s not only a 2038 issue
Software that deals with future dates hits the limit early. A 30-year mortgage, a long-lived TLS certificate, a pension projection or a “never expires” value set to 50 years ahead can already produce dates past 2038. Systems like these were among the first to surface Y2K38 bugs.
Where 32-bit time still lurks
- Embedded and industrial devices — routers, controllers, cars, medical and building systems — which run for decades and are rarely updated.
- Old 32-bit software and operating systems that were compiled with a 32-bit
time_t. - Database column types. MySQL’s
TIMESTAMPtype, for example, only supports values up to 2038-01-19 03:14:07 UTC; itsDATETIMEtype does not have that limit. - File formats and network protocols that define a 32-bit seconds field in their specification, which cannot change without a new version of the format.
- Application code that casts a timestamp into a 32-bit
int“because it fits”.
The fix: 64-bit time
Storing seconds in a signed 64-bit integer pushes the overflow roughly 292 billion years into the future — far beyond any practical concern. Most of the ecosystem has already moved:
- 64-bit operating systems have used a 64-bit
time_tfor many years. - The Linux kernel added 64-bit time support for 32-bit architectures in version 5.6 (2020), and glibc 2.34 lets 32-bit programs opt in by compiling with
_TIME_BITS=64. - Modern languages such as Java, Go, Python, JavaScript, C# and Rust represent time with 64-bit (or larger) values internally.
Some systems instead reinterpret the 32-bit value as unsigned, which extends the range to 2106-02-07 06:28:15 UTC but gives up the ability to represent dates before 1970. That buys time, not a permanent fix.
How to check your own systems
- Search code for timestamps stored in 32-bit integer types or cast with
(int). - Check database schemas for
TIMESTAMPcolumns orINTcolumns holding epoch seconds. - Test with dates after 2038: set an expiry or schedule to 2040 and see what happens end to end.
- Inventory long-lived embedded hardware and ask vendors about their 2038 support.