Year 2038 problem
Before the infamous Y2K bug, there was a less-known but equally profound digital time bomb ticking, waiting to disrupt computer systems worldwide—the Year 2038 problem. This impending digital crisis threatens to roll back the clocks of countless devices, potentially causing chaos in our increasingly connected world. Understanding its origins in the very architecture of how computers keep time reveals a fascinating intersection of mathematics and modern technology. The Year 2038 problem stems from a fundamental limitation in how many computer systems store time, specifically using a 32-bit integer. When the system clock reaches a critical second in January 2038, it will 'overflow,' causing computers to mistakenly believe the date has reverted to 1901. Legacy and embedded systems, which are difficult to update, are particularly vulnerable, posing risks to infrastructure and daily life if not addressed proactively.
AI Summary
Before the infamous Y2K bug, there was a less-known but equally profound digital time bomb ticking, waiting to disrupt computer systems worldwide—the Year 2038 problem. This impending digital crisis threatens to roll back the clocks of countless devices, potentially causing chaos in our increasingly connected world. Understanding its origins in the very architecture of how computers keep time reveals a fascinating intersection of mathematics and modern technology.
- The Year 2038 problem stems from a fundamental limitation in how many computer systems store time, specifically using a 32-bit integer.
- When the system clock reaches a critical second in January 2038, it will 'overflow,' causing computers to mistakenly believe the date has reverted to 1901.
- Legacy and embedded systems, which are difficult to update, are particularly vulnerable, posing risks to infrastructure and daily life if not addressed proactively.
The Countdown to Zero Hour
Imagine waking up one day and finding that your computer thinks it’s 1901. That's the core of the 'Year 2038 problem,' also known as Y2K38 or the 'Epochalypse.' It's a digital time bomb, threatening to turn our future into the past for millions of computer systems worldwide.
The critical moment arrives precisely at 03:14:07 UTC on January 19, 2038. At this exact second, certain computer systems will hit their internal limit for representing time, leading to unexpected and potentially catastrophic errors.
How Computers Keep Time: The Unix Epoch
To understand this problem, we first need to understand 'Unix time.' It's a widely adopted international standard for digital timekeeping, measuring time as a simple count of seconds. But seconds since when, exactly? Since 00:00:00 UTC on January 1, 1970.
This arbitrary starting point, dubbed the 'Unix epoch,' was chosen because it coincided with the birth of the Unix operating system. From that moment forward, every second that passes is simply added to the count.
The 32-Bit Barrier
The problem arises because many older computer systems store this 'second count' in a data type called a 'signed 32-bit integer.' Think of it as a small container that can only hold a certain range of numbers.
A 32-bit integer uses 32 binary digits, or bits, to represent a number. 'Signed' means it can represent both positive and negative values. For a 32-bit signed integer, the maximum positive value it can hold is 2,147,483,647.
This seemingly large number is actually a very precise limit. It represents the maximum number of seconds that can be counted from the Unix epoch before the system runs out of room. This maximum value, as we've seen, corresponds to 03:14:07 UTC on January 19, 2038.
2^{31} - 1 = 2,147,483,647The Rollback: From Future to Past
When the clock attempts to tick past that limit—to 03:14:08 UTC on January 19, 2038—the signed 32-bit integer 'overflows.' Instead of going higher, its value 'wraps around' to the smallest negative number it can represent.
This sudden flip to a negative value causes the system to interpret the date as December 13, 1901. Essentially, the computer's calendar gets reset by over a century! From this point, it will continue counting upwards, back towards zero and then positive values again.
-(2^{31}) = -2,147,483,648Who is Vulnerable?
While modern computer systems have largely adopted more robust ways of tracking time, the Year 2038 problem poses a significant threat to legacy systems and 'embedded systems'—the specialized computers hidden within larger devices.
The Hidden Computers Among Us
Embedded systems are everywhere: in cars, planes, industrial control systems, medical devices, and communication networks. These systems are often designed to last for decades, and many may still be operational in 2038. Updating their software can be difficult, if not impossible, due to their specialized nature and the cost involved.
Consider critical components in transportation, such as anti-lock braking systems (ABS) or electronic stability control (ESC) in older cars. Even decades-old vehicles could still be on the road in 2038, relying on 32-bit systems for essential functions. Similarly, older GPS receivers or industrial sensors might suddenly misinterpret time.
Some cell phones running older 32-bit Android versions, for example, have already been observed to crash when their internal clock is manually advanced to the Y2038 date. This offers a worrying glimpse into what could happen on a much larger scale.
An Early Warning: The AOLserver Incident
The Y2038 problem isn't just a theoretical future threat; it's already shown its face. In May 2006, the AOLserver software experienced an early manifestation of the bug. It was designed with a 'never time out' feature for database requests, simply by setting a timeout date a billion seconds in the future.
However, a billion seconds before the 2038 cutoff date fell in 2006. Requests made after this time resulted in a timeout date that exceeded the 32-bit limit, causing an overflow. The system mistakenly calculated the timeout date to be in the distant past, leading to software crashes.
The Path to Resolution
There's no single, universal fix for the Year 2038 problem. Changing the fundamental 'timet' data type in programming languages like C, which is widely used, can create code compatibility nightmares for existing applications.
Simply switching to an 'unsigned' 32-bit integer would push the problem back to 2106, but it would break any systems needing to represent dates before the 1970 epoch, as these are stored as negative numbers.
The 64-Bit Solution
The most common and robust solution is to adopt 'signed 64-bit integers' for time representation. This vastly expands the range of values that can be stored, offering an immense buffer against overflow.
A 64-bit signed integer can represent values up to approximately 9.22 quintillion seconds. This means a new wraparound date would occur roughly 292 billion years from now—about 21 times the estimated age of the universe. So, we're likely safe on that front for a while!
2^{63} - 1 \approx 9.22 \times 10^{18}Many modern 64-bit operating systems already utilize this approach. Furthermore, alternative solutions exist, such as storing milliseconds or microseconds since the epoch in a 64-bit integer, providing even finer resolution and extending the range to millions of years. Java and JavaScript, for instance, already use a similar millisecond-based system.
Article
Year 2038 problem
An animated visual of the bug in action. The overflow error will occur at 03:14:08 UTC on 19 January 2038.
The year 2038 problem (also known as Y2038, Y2K38, Y2K38 superbug, or the Epochalypse) is a time computing problem that leaves some computer systems unable to represent times after 03:14:07 UTC on 19 January 2038.
The problem exists in systems which measure Unix time—the number of seconds elapsed since the Unix epoch (00:00:00 UTC on 1 January 1970)—and store it in a signed 32-bit integer. When the data type's maximum value is surpassed, the integer will overflow to its minimum value, which systems will interpret as in the past. The problem resembles the year 2000 problem but arises from limitations in base-2 (binary) time representation, rather than base-10.
Computer systems that use time for critical computations may encounter fatal errors if the year 2038 problem is not addressed. Some applications that use future dates have already encountered the bug. The most vulnerable systems are those which are infrequently or never updated, such as legacy and embedded systems. Modern systems and software updates address this problem by using signed 64-bit integers, which will take 292 billion years to overflow—approximately 21 times the estimated age of the universe.
Cause
Year 2038 problem
Many computer systems measure time and date using Unix time, an international standard for digital timekeeping. Unix time is defined as the number of seconds elapsed, ignoring leap seconds, since 00:00:00 UTC on 1 January 1970, known as the Unix epoch.
Unix time has historically been encoded as a signed 32-bit integer, a data type composed of 32 binary digits (bits) which represent an integer value, with 'signed' meaning that the number can represent both positive and negative numbers, as well as zero; and is usually stored in two's complement format. Thus, a signed 32-bit integer can only represent integer values from −(231) to 231 − 1 inclusive. Consequently, if a signed 32-bit integer is used to store Unix time, the latest time that can be stored is 231 − 1 (2,147,483,647) seconds after epoch, which is 03:14:07 UTC on 19 January 2038. Systems that attempt to increment this value by one more second to 231 seconds after epoch (03:14:08) will suffer integer overflow, inadvertently flipping the sign bit to indicate a negative number. This changes the integer value to −(231), or 231 seconds before epoch rather than after, which systems will interpret as 20:45:52 UTC on 13 December 1901. From here, systems will continue to count up, toward zero, and then up through the positive integers again. As many computer systems use time computations to run critical functions, the bug may introduce serious problems.
Vulnerable systems
Year 2038 problem
Any system using data structures with signed 32-bit time representations has an inherent risk of failing. A full list of these data structures is virtually impossible to derive, but there are well-known data structures that have the Unix time problem:
• File systems that use 32 bits to represent times in inodes, such as ext2, ext3, and reiserFS. • Databases with 32-bit time fields. • Database query languages (such as SQL) that have UNIXTIMESTAMP()-like commands. • Many 32-bit Android devices on Android 4 or earlier, including ZTE Blade, Google Nexus 7 and 2012 Toshiba Android tablets. • OS X-era PowerPC Macs will have their system clock get stuck on the rollover time as of Mac OS X Tiger. • 32-bit iOS devices as of iPhone 5 on circa iOS 9 will be unable to unlock or to consistently enter charging mode, and the lockscreen clock will not show up. • As of circa Windows 10 version 22H2, if an x86 (32-bit) device has not been turned on at the rollover point, but is started up after the rollover, the system clock can skip ahead to April 12, 2160, and the date options in Windows 10's main settings menu does not show any selectable numbers. • Software built with Visual Studio has the gmtime32 format (which serves as a mapping of timet's 32-bit version) roll over at 19 January 2038 00:00:00. Software built with pre-2005 versions of Visual Studio were known to have gmtime correspond to gmtime32, and the correspondence can be forced when building with 32-bit versions of Visual Studio through Visual Studio 2019 by specifying USE32BITTIMET.
Embedded systems
Embedded systems that use dates for either computation or diagnostic logging are most likely to be affected by the Y2038 problem. Despite the modern 18–24 month generational update in computer systems technology, embedded systems are designed to last the lifetime of the machine in which they are a component. It is conceivable that some of these systems may still be in use in 2038. It may be difficult or, in some cases, impossible to upgrade the software running these systems, ultimately requiring replacement if the 32-bit limitations are to be corrected.
Many transportation systems, from flight to automobiles, use embedded systems extensively. In automotive systems, this may include anti-lock braking system (ABS), electronic stability control (ESC/ESP), traction control (TCS), and automatic four-wheel drive; aircraft may use inertial guidance systems and GPS receivers.
Another major use of embedded systems is in communications devices, including cell phones and Internet-enabled appliances (e.g. routers, wireless access points, IP cameras) which rely on storing an accurate time and date and are increasingly based on Unix-like operating systems.
However, this does not imply that all embedded systems will suffer from the Y2038 problem, since many such systems do not require access to dates. For those that do, those systems which only track the difference between times/dates and not absolute times/dates will, by the nature of the calculation, not experience a major problem. This is the case for automotive diagnostics based on legislated standards such as CARB (California Air Resources Board).
Early problems
Year 2038 problem
In May 2006, reports surfaced of an early manifestation of the Y2038 problem in the AOLserver software. The software was designed with a kludge to handle a database request that should "never" time out. Rather than specifically handling this special case, the initial design simply specified an arbitrary time-out date in the future with a default configuration specifying that requests should time out after a maximum of one billion seconds. However, one billion seconds before the 2038 cutoff date is 01:27:28 UTC on 13 May 2006, so requests sent after this time would result in a time-out date which is beyond the cutoff. This made time-out calculations overflow and return dates that were actually in the past, causing software to crash. When the problem was discovered, AOLServer operators had to edit the configuration file and set the time-out to a lower value.
Many types of self-signed CA certificates generated on 32-bit systems can have very long expiration dates that go beyond the rollover point, which will make them not work correctly, affecting HTTPS verifications on services (for instance VPNs) and sites that use them.
The MS Filtering Engine Update anti-malware functions of Microsoft Exchange Server installations broke on January 1, 2022 after an update. The functions mapped the processed UpdateVersion numbers (which used a 9- or 10-digit YY-MM-DD-n format) to the Unix time stamp numbers despite their times being very different, so when the engine received the 220101001 (22-01-01 v001) update, which it took to mean 2201010001 with an extra zero near the end, it tried mapping it to the 32-bit Unix time's number and failed due to being higher than 2147483647. Affected Exchange servers failed to work unless they turned off the anti-malware functions, and an automated fix was published on January 5, 2022.
In Oracle Access Management version 10.1.4.3 for Windows, the Identity Console component sets a cookie containing UI preferences with an expiry of 500,000,000 seconds in the future (approximately 15 years, 312 days). This is beyond 19 January 2038 and so it throws an exception for certain search activities after 02:20:48 UTC on 17 March 2022 because the gmtimer() call cannot convert the number provided to a date to write to the cookie.
Solutions
Year 2038 problem
There is no universal solution for the Year 2038 problem. For example, in the C language, any change to the definition of the timet data type would result in code-compatibility problems in any application in which date and time representations are dependent on the nature of the signed 32-bit timet integer. Changing timet to an unsigned 32-bit integer, which would extend the range to 2106 (specifically, 06:28:15 UTC on Sunday, 7 February 2106), would adversely affect programs that store, retrieve, or manipulate dates prior to 1970, as such dates are represented by negative numbers. Increasing the size of the timet type to 64 bits in an existing system would cause incompatible changes to the layout of structures and the binary interface of functions.
Most operating systems designed to run on 64-bit hardware already use signed 64-bit timet integers. Using a signed 64-bit value introduces a new wraparound date that is over twenty times greater than the estimated age of the universe: approximately 292 billion years from now. The ability to make computations on dates is limited by the fact that tmyear uses a signed 32-bit integer value starting at 1900 for the year. This limits the year to a maximum of 2,147,485,547 (2,147,483,647 + 1900).
Alternative proposals have been made (some of which are already in use), such as storing either milliseconds or microseconds since an epoch (typically either 1 January 1970 or 1 January 2000) in a signed 64-bit integer, providing a minimum range of 292,000 years at microsecond resolution. In particular, Java's and JavaScript's use of 64-bit signed integers to represent absolute timestamps as "milliseconds since 1 January 1970" will work correctly for the next 292 million years. Other proposals for new time representations provide different precisions, ranges, and sizes (almost always wider than 32 bits), as well as solving other related problems, such as the handling of leap seconds. In particular, TAI64 is an implementation of the International Atomic Time (TAI) standard, the current international real-time standard for defining a second and frame of reference.
Implemented solutions
• Starting with Ruby version 1.9.2 (released on 18 August 2010), the bug with year 2038 is fixed, by storing time in a signed 64-bit integer on systems with 32-bit timet. • Starting with NetBSD version 6.0 (released in October 2012), the NetBSD operating system uses a 64-bit timet for both 32-bit and 64-bit architectures. Applications that were compiled for an older NetBSD release with 32-bit timet are supported via a binary compatibility layer, but such older applications will still suffer from the Y2038 problem. • OpenBSD since version 5.5, released in May 2014, also uses a 64-bit timet for both 32-bit and 64-bit architectures. In contrast to NetBSD, there is no binary compatibility layer. Therefore, applications expecting a 32-bit timet and applications using anything different from timet to store time values may break. • Linux originally used a 64-bit timet for 64-bit architectures only; the pure 32-bit ABI was not changed due to backward compatibility. Starting with version 5.6 of 2020, 64-bit timet is supported on 32-bit architectures, too. This was done primarily for the sake of embedded Linux systems. • GNU C Library since version 2.34 (released August 2021), added support for using 64-bit timet on 32-bit platforms with appropriate Linux versions. This support can be activated by defining preprocessor macro TIMEBITS to 64 when compiling source code. • FreeBSD uses 64-bit timet for all 32-bit and 64-bit architectures except 32-bit i386, which uses signed 32-bit timet instead. • The x32 ABI for Linux (which defines an environment for programs with 32-bit addresses but running the processor in 64-bit mode) uses a 64-bit timet. Since it was a new environment, there was no need for special compatibility precautions. • Network File System version 4 has defined its time fields as struct nfstime4 {int64t seconds; uint32t nseconds;} since December 2000. Version 3 supports unsigned 32-bit values as struct nfstime3 {uint32 seconds; uint32 nseconds;};. Values greater than zero for the seconds field denote dates after the 0-hour, January 1, 1970. Values less than zero for the seconds field denote dates before the 0-hour, January 1, 1970. In both cases, the nseconds (nanoseconds) field is to be added to the seconds field for the final time representation. • The ext4 filesystem, when used with inode sizes larger than 128 bytes, has an extra 32-bit field per timestamp, of which 30 bits are used for the nanoseconds part of the timestamp, and the other 2 bits are used to extend the timestamp range to the year 2446. • The XFS filesystem, starting with Linux 5.10, has an optional "big timestamps" feature which extends the timestamp range to the year 2486. • While the native APIs of OpenVMS can support timestamps up to 31 July 31086, the C runtime library (CRTL) uses 32-bit integers for timet. As part of Y2K compliance work that was carried out in 1998, the CRTL was modified to use unsigned 32-bit integers to represent time; extending the range of timet up to 7 February 2106. • As of MySQL 8.0.28, released in January 2022, the functions FROMUNIXTIME(), UNIXTIMESTAMP(), and CONVERTTZ() handle 64-bit values on platforms that support them. This includes 64-bit versions of Linux, macOS, and Windows. In older versions, built-in functions like UNIXTIMESTAMP() will return 0 after 03:14:07 UTC on 19 January 2038. • As of MariaDB 11.5.1, released in May 2024, the data type TIMESTAMP and functions FROMUNIXTIME(), UNIXTIMESTAMP(), and CONVERTTZ() handle unsigned 32-bit values on 64-bit versions of Linux, macOS, and Windows. This extended the range to 2106-02-07 06:28:15 and allowed users to store such timestamp values in tables without changing the storage layout and thus staying fully compatible with existing user data. • Starting with Visual C++ 2005, the CRT uses a 64-bit timet unless the USE32BITTIMET preprocessor macro is defined. However, the Windows API itself is unaffected by the year 2038 bug, as Windows internally tracks time as the number of 100-nanosecond intervals since 1 January 1601 in a 64-bit signed integer, which will not overflow until year 30,828. • The OS X rollover stuck system clock bug had been fixed as of Mac OS X El Capitan. • DOSBox-X removed a dependency on the Int32x32To64 macro for time calculation in version 2025.02.01. • For Windows devices whose clocks have jumped ahead, a number of software tools to edit system settings or to sync with time servers exist that can mitigate any effects. • Microsoft's syntax guides for Visual Studio have discouraged the use of USE32BITTIMET, and it has not been allowed when building with 64-bit versions of Visual Studio. • Despite the age of the Oracle Access Manager version in question (18 June 2009), Oracle issued the patch 33983548 on 6 April 2022. Newer versions of Oracle Access Manager are not known to be affected by the problem.