Year 2038 problem: Difference between revisions
imported>CDVDBD →Vulnerable systems: Added examples for affected file systems. |
imported>Pro-anti-air m →See also: Fix link to avoid section |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{short description|Computer software bug occurring in 2038}} | {{short description|Computer software bug occurring in 2038}} | ||
[[File:Year 2038 problem.gif|thumb|upright=2.0|An animated visual of the bug in action. The [[integer overflow|overflow]] error will occur at 03:14:08 UTC on 19 January 2038.]] | [[File:Year 2038 problem.gif|thumb|upright=2.0|An animated visual of the bug in action. The [[integer overflow|overflow]] error will occur at 03:14:08 UTC on 19 January 2038.]] | ||
The '''year 2038 problem''' (also known as '''Y2038''',<ref name=":0" /> '''Y2K38''', '''Y2K38 superbug''' or the '''Epochalypse'''<ref>{{cite web |url=https://www.linaro.org/blog/the-end-of-an-era/ |title=The end of an Era |date=February 6, 2020 |first=Arnd |last=Bergmann |publisher=Linaro |access-date=13 September 2020 |archive-date=7 February 2020 |archive-url=https://web.archive.org/web/20200207034639/https://www.linaro.org/blog/the-end-of-an-era/ |url-status=live }}</ref><ref>{{cite news |url=https://www.tomsguide.com/us/2038-bug-bh2017,news-25551.html |title=Digital 'Epochalypse' Could Bring World to Grinding Halt |first=Paul |last=Wagenseil |date=July 28, 2017 |work=Tom's Guide |access-date=13 September 2020 |archive-date=29 November 2021 |archive-url=https://web.archive.org/web/20211129222317/https://www.tomsguide.com/us/2038-bug-bh2017,news-25551.html |url-status=live }}</ref>) is a [[Time formatting and storage bugs|time computing problem]] that leaves some computer systems unable to represent times after 03:14:07 [[Coordinated Universal Time|UTC]] on 19 January 2038. | The '''year 2038 problem''' (also known as '''Y2038''',<ref name=":0" /> '''Y2K38''', '''Y2K38 superbug''', or the '''Epochalypse'''<ref>{{cite web |url=https://www.linaro.org/blog/the-end-of-an-era/ |title=The end of an Era |date=February 6, 2020 |first=Arnd |last=Bergmann |publisher=Linaro |access-date=13 September 2020 |archive-date=7 February 2020 |archive-url=https://web.archive.org/web/20200207034639/https://www.linaro.org/blog/the-end-of-an-era/ |url-status=live }}</ref><ref>{{cite news |url=https://www.tomsguide.com/us/2038-bug-bh2017,news-25551.html |title=Digital 'Epochalypse' Could Bring World to Grinding Halt |first=Paul |last=Wagenseil |date=July 28, 2017 |work=Tom's Guide |access-date=13 September 2020 |archive-date=29 November 2021 |archive-url=https://web.archive.org/web/20211129222317/https://www.tomsguide.com/us/2038-bug-bh2017,news-25551.html |url-status=live }}</ref>) is a [[Time formatting and storage bugs|time computing problem]] that leaves some computer systems unable to represent times after 03:14:07 [[Coordinated Universal Time|UTC]] on 19 January 2038. | ||
The problem exists in systems which measure [[Unix time]] | The problem exists in systems which measure [[Unix time]]—the number of seconds elapsed since the Unix [[epoch (computing)|epoch]] (00:00:00 UTC on 1 January 1970)—and store it in a [[Integer (computer science)|signed 32-bit integer]]. The data type is only capable of representing integers between −(2{{sup|31}}) and 2{{sup|31}} − 1, meaning the latest time that can be properly encoded is 2{{sup|31}} − 1 seconds after epoch (03:14:07 UTC on 19 January 2038). Attempting to increment to the following second (03:14:08) will cause the [[integer overflow|integer to overflow]], setting its value to −(2{{sup|31}}) which systems will interpret as 2{{sup|31}} seconds ''before'' epoch (20:45:52 UTC on 13 December 1901). Systems using ''unsigned'' 32-bit integers will overflow in [[Time formatting and storage bugs#Year 2106|2106]]. The problem resembles the [[year 2000 problem]] but arises from limitations in [[Binary number|base-2]] (binary) time representation, rather than [[Decimal|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.<ref name=":1" /><ref name=":2" /> The most vulnerable systems are those which are infrequently or never updated, such as [[Legacy system|legacy]] and [[embedded system]]s. Modern systems and software updates to legacy systems address this problem by using signed [[64-bit computing|64-bit]] integers instead of 32-bit integers, which will take 292 billion years to overflow—approximately 21 times the estimated [[age of the universe]].<ref>2{{sup|63}} seconds ÷ 60 seconds/minute ÷ 60 minutes/hour ÷ 24 hours/day ÷ (146097 days/400 years =) 365.2425 days/Gregorian year [≈ 292.277 billion (Gregorian) years] ÷ [[age of the universe|13.79 billion years]] ≈ 21.19 times the estimated age of the universe after midnight [[Coordinated Universal Time|UTC]] on January 1, 1970, neglecting [[leap second]]s. | |||
</ref> | |||
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.<ref name=":1" /><ref name=":2" /> The most vulnerable systems are those which are infrequently or never updated, such as [[Legacy system|legacy]] and [[embedded system]]s. Modern systems and software updates to legacy systems address this problem by using signed [[64-bit computing|64-bit]] integers instead of 32-bit integers, which will take 292 billion years to overflow—approximately 21 times the estimated [[age of the universe]]. | |||
== Cause == | == Cause == | ||
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 since 00:00:00 [[Coordinated Universal Time|UTC]] on 1 January 1970 | 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 [[Coordinated Universal Time|UTC]] on 1 January 1970, known as the ''Unix epoch''. | ||
Unix time has historically been encoded as a [[integer (computer science)|signed 32-bit integer]], a data type composed of 32 [[Bit|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.{{efn|Unless otherwise specified, all the numbers provided in this article have been derived using two's complement for signed integer arithmetic.}} Thus, a signed 32-bit integer can only represent integer values from | Unix time has historically been encoded as a [[integer (computer science)|signed 32-bit integer]], a data type composed of 32 [[Bit|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.{{efn|Unless otherwise specified, all the numbers provided in this article have been derived using two's complement for signed integer arithmetic.}} Thus, a signed 32-bit integer can only represent integer values from −(2{{sup|31}}) to 2{{sup|31}} − 1 inclusive. Consequently, if a signed 32-bit integer is used to store Unix time, the latest time that can be stored is 2{{sup|31}} − 1 ({{val |{{#expr:2^31 -1}} |fmt=commas}}) {{efn|[[2,147,483,647]] is a double Mersenne prime}} seconds after epoch, which is {{#time:H:i:s T "on" j F Y|@{{#expr:2^31 -1}}}}.<ref name="spinellis">{{cite book|author=Diomidis Spinellis|url=https://books.google.com/books?id=vEN-ckcdtCwC&q=292%2C277%2C026%2C596&pg=PA49|title=Code quality: the open source perspective|publisher=[[Adobe Press]]|year=2006|isbn=978-0-321-16607-4|edition=illustrated|series=Effective software development series in [[Safari Books Online]]|page=49}}</ref> Systems that attempt to increment this value by one more second to 2{{sup|31}} seconds after epoch ({{#time:H:i:s|@{{#expr:2^31}}}}) will suffer [[integer overflow]], inadvertently flipping the sign bit to indicate a negative number. This changes the integer value to −(2{{sup|31}}), or 2{{sup|31}} seconds ''before'' epoch rather than ''after'', which systems will interpret as {{#time:H:i:s T "on" j F Y|@{{#expr:-2^31}}}}. 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 == | == Vulnerable systems == | ||
Any system using [[data structure]]s 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: | Any system using [[data structure]]s 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 [[inode]]s, such as [[ext2]], [[ext3]], [[reiserFS]]. | * File systems that use 32 bits to represent times in [[inode]]s, such as [[ext2]], [[ext3]], and [[reiserFS]]. | ||
* Databases with 32-bit time fields | * Databases with 32-bit time fields. | ||
* Database query languages (such as [[SQL]]) that have <code>UNIX_TIMESTAMP()</code>-like commands | * Database query languages (such as [[SQL]]) that have <code>UNIX_TIMESTAMP()</code>-like commands. | ||
* Many 32-bit [[Android (operating system)|Android]] devices on Android 4 or earlier, including [[ZTE Blade]],<ref>{{cite web|title=ZTE Blade running Android 2.2 has 2038 problems|url=https://issuetracker.google.com/issues/36928638|access-date=20 November 2018|archive-date=19 May 2022|archive-url=https://web.archive.org/web/20220519230355/https://issuetracker.google.com/issues/36928638|url-status=live}}</ref> [[Google Nexus]] 7<ref>{{Cite web|url=https://www.informationweek.com/it-infrastructure/25-years-from-today-a-time-for-bugs|title=25 Years From Today: A Time for Bugs|date=19 January 2013|access-date=16 August 2025|publisher=[[InformationWeek]]|author=Larry Seltzer|archive-date=26 August 2025|archive-url=https://web.archive.org/web/20250826082920/https://www.informationweek.com/it-infrastructure/25-years-from-today-a-time-for-bugs|url-status=live}}</ref> and 2012 [[Toshiba]] [[Android (operating system)|Android]] tablets.<ref>{{Cite web|url=https://fcc.report/FCC-ID/VUIPDA4330LB/1672079.pdf|title=Toshiba TOSHIBA AT300|access-date=16 August 2025|date=2012|archive-date=4 September 2025|archive-url=https://web.archive.org/web/20250904173747/https://fcc.report/FCC-ID/VUIPDA4330LB/1672079.pdf|url-status=live}}</ref> | |||
* [[OS X]]-era [[PowerPC]] Macs will have their system clock get stuck on the rollover time as of [[Mac OS X Tiger]].<ref>{{Cite web|archive-url=https://web.archive.org/web/20140716041333/https://blog.interlinked.org/misc/2038.html|archive-date=16 July 2014|publisher=Interlinked|title=The year 2038 problem|url-status=dead|url=https://blog.interlinked.org/misc/2038.html|access-date=16 August 2025}}</ref> | |||
* 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.<ref>{{Cite web |author=Ternary |date=10 December 2015 |title=The iPhone Apocalypse: January 19, 2038 |url=https://forums.macrumors.com/threads/the-iphone-apocalypse-january-19-2038.1943912/ |access-date=17 August 2025 |publisher=[[MacRumors]]}}</ref> | |||
* As of circa [[Windows 10]] version [[Windows 10, version 22H2|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 skips ahead to April 12, 2160, and the date options in Windows 10's main settings menu does not show any selectable numbers.<ref>{{Cite web|url=https://www.neowin.net/news/remember-y2k-windows-95-98-2000-era-app-surprisingly-stands-tall-against-y2k38-superbug/|title=Remember Y2K? Windows 95, 98, 2000-era app surprisingly stands tall against Y2K38 superbug|publisher=[[Neowin]]|date=6 March 2024|access-date=19 August 2025|author=Sayan Sen|archive-date=3 September 2025|archive-url=https://web.archive.org/web/20250903102114/https://www.neowin.net/news/remember-y2k-windows-95-98-2000-era-app-surprisingly-stands-tall-against-y2k38-superbug/|url-status=live}}</ref> | |||
* Software built with [[Visual Studio]] has the <code>_gmtime32</code> format (which serves as a mapping of <code>time_t</code>'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 <code>_gmtime</code> correspond to <code>_gmtime32</code>, and the correspondence can be forced when building with 32-bit versions of Visual Studio through Visual Studio 2019 by specifying <code>_USE_32BIT_TIME_T</code>.<ref name=gmtimelearn>{{Cite web|url=https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/gmtime-gmtime32-gmtime64?view=msvc-170|title=gmtime, _gmtime32, _gmtime64|access-date=11 September 2025|date=2 March 2024|publisher=Microsoft Learn|archive-date=8 December 2024|archive-url=https://web.archive.org/web/20241208103627/https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/gmtime-gmtime32-gmtime64?view=msvc-170|url-status=live}}</ref> | |||
=== Embedded systems === | === Embedded systems === | ||
[[Embedded system]]s that use dates for either computation or diagnostic logging are most likely to be affected by the Y2038 problem.<ref name=":0">{{ | [[Embedded system]]s that use dates for either computation or diagnostic logging are most likely to be affected by the Y2038 problem.<ref name=":0">{{Cite news |last=Gibbs |first=Samuel |date=17 December 2014 |title=Is the Year 2038 problem the new Y2K bug? |url=https://www.theguardian.com/technology/2014/dec/17/is-the-year-2038-problem-the-new-y2k-bug |url-status=live |archive-url=https://web.archive.org/web/20220125075051/https://www.theguardian.com/technology/2014/dec/17/is-the-year-2038-problem-the-new-y2k-bug |archive-date=25 January 2022 |access-date=11 October 2018 |work=The Guardian}}</ref> Despite the modern [[Moore's law|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. <!-- Please do not delete - for decades, there will be plenty of older cars on the road, which will use the same outdated 8/16 bit systems for decades, unless something changes. Actually it already has - engine controllers have been mostly 32-bit for a decade! But the point stands, that legacy systems can't easily be changed. --> In automotive systems, this may include [[anti-lock braking system]] (ABS), [[electronic stability control]] (ESC/ESP), [[Traction control system|traction control]] (TCS) and automatic [[four-wheel drive]]; aircraft may use [[Inertial navigation system|inertial guidance systems]] and [[Satellite navigation device|GPS receivers]].{{efn|GPS suffers its own time counter overflow problem known as [[GPS Week Number Rollover]].}} Another major use of embedded systems is in communications devices, including cell | Many transportation systems, from flight to automobiles, use embedded systems extensively. <!-- Please do not delete - for decades, there will be plenty of older cars on the road, which will use the same outdated 8/16 bit systems for decades, unless something changes. Actually it already has - engine controllers have been mostly 32-bit for a decade! But the point stands, that legacy systems can't easily be changed. --> In automotive systems, this may include [[anti-lock braking system]] (ABS), [[electronic stability control]] (ESC/ESP), [[Traction control system|traction control]] (TCS), and automatic [[four-wheel drive]]; aircraft may use [[Inertial navigation system|inertial guidance systems]] and [[Satellite navigation device|GPS receivers]].{{efn|GPS suffers its own time counter overflow problem known as [[GPS Week Number Rollover]].}} | ||
Another major use of embedded systems is in communications devices, including [[cell phone]]s and Internet-enabled appliances (e.g. [[Router (computing)|routers]], [[wireless access point]]s, [[IP camera]]s) 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]]).<ref>{{cite web|url=http://www.arb.ca.gov/testmeth/testmeth.htm#vehicles|title=ARB Test Methods / Procedures|publisher=[[California Air Resources Board]]|website=ARB.ca.gov|access-date=12 September 2013|archive-date=18 November 2016|archive-url=https://web.archive.org/web/20161118163253/https://www.arb.ca.gov/testmeth/testmeth.htm#vehicles|url-status=dead}}</ref> | 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]]).<ref>{{cite web|url=http://www.arb.ca.gov/testmeth/testmeth.htm#vehicles|title=ARB Test Methods / Procedures|publisher=[[California Air Resources Board]]|website=ARB.ca.gov|access-date=12 September 2013|archive-date=18 November 2016|archive-url=https://web.archive.org/web/20161118163253/https://www.arb.ca.gov/testmeth/testmeth.htm#vehicles|url-status=dead}}</ref> | ||
| Line 29: | Line 35: | ||
== Early problems == | == Early problems == | ||
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 [[Timeout (computing)|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.<ref name=":1">{{cite web|date=28 June 2006|title=The Future Lies Ahead|url=http://substitute.livejournal.com/1430908.html|access-date=19 November 2006|archive-date=28 November 2006|archive-url=https://web.archive.org/web/20061128235428/http://substitute.livejournal.com/1430908.html|url-status=live}}</ref><ref name=":2">[http://www.mail-archive.com/aolserver@listserv.aol.com/msg09844.html Weird "memory leak" problem in AOLserver 3.4.2/3.x] {{Webarchive|url=https://web.archive.org/web/20100104130626/http://www.mail-archive.com/aolserver@listserv.aol.com/msg09844.html |date=4 January 2010 }} 12 May 2006</ref> | 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 [[Timeout (computing)|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.<ref name=":1">{{cite web|date=28 June 2006|title=The Future Lies Ahead|url=http://substitute.livejournal.com/1430908.html|access-date=19 November 2006|archive-date=28 November 2006|archive-url=https://web.archive.org/web/20061128235428/http://substitute.livejournal.com/1430908.html|url-status=live}}</ref><ref name=":2">[http://www.mail-archive.com/aolserver@listserv.aol.com/msg09844.html Weird "memory leak" problem in AOLserver 3.4.2/3.x] {{Webarchive|url=https://web.archive.org/web/20100104130626/http://www.mail-archive.com/aolserver@listserv.aol.com/msg09844.html |date=4 January 2010 }} 12 May 2006</ref> | ||
Many types of self-signed [[Certificate authority|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 [[Virtual Private Network|VPNs]]) and sites that use them.<ref>{{Cite web|url=https://www.theregister.com/2024/02/09/it_incident_report_the_clock/|author=Thomas Claburn|date=9 February 2025|access-date=17 August 2025|publisher=[[The Register]]|title=Curious tale of broken VPNs, the Year 2038, and certs that expired 100 years ago|archive-date=1 August 2025|archive-url=https://web.archive.org/web/20250801142159/https://www.theregister.com/2024/02/09/it_incident_report_the_clock/|url-status=live}}</ref> | |||
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.<ref>{{Cite web|url=https://www.neowin.net/news/y2k22-bug-microsoft-rings-in-the-new-year-by-breaking-exchange-servers-all-around-the-world/|title=Y2K22 bug: Microsoft rings in the new year by breaking Exchange servers all around the world|date=1 January 2022|access-date=19 August 2025|publisher=[[Neowin]]|author=Dean Howell|archive-date=24 August 2025|archive-url=https://web.archive.org/web/20250824044327/https://www.neowin.net/news/y2k22-bug-microsoft-rings-in-the-new-year-by-breaking-exchange-servers-all-around-the-world/|url-status=live}}</ref> 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 Corporation|Oracle]] Access Management version 10.1.4.3 for Windows, the Identity Console component sets a cookie containing [[User interface|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 handling|exception]] for certain search activities after 02:20:48 UTC on 17 March 2022 because the <code>gmtime_r()</code> call cannot convert the number provided to a date to write to the cookie.<ref>{{cite web|title=Oracle Access Manager |url=https://forums.oracle.com/ords/apexds/post/oracle-access-manager-5412#323523248071078005693687052982423282497 |website=Oracle Communities |date=24 March 2022 |publisher=Oracle Corporation|access-date=25 February 2023}}</ref> | |||
Some versions of [[Windows Media Player Legacy]] refuse to run or be set up if the system time is on or after January 1, 2038.<ref>{{cite web |title=Your outdated version of Windows Media Player 6 will still work after the Y2K38 bug ends civilization |url=https://www.techspot.com/news/102174-outdated-version-windows-media-player-6-work-after.html |website=www.techspot.com |date=7 March 2024 |publisher=Techspot |access-date=2 November 2023 |archive-date=7 March 2024 |archive-url=https://web.archive.org/web/20240307235305/https://www.techspot.com/news/102174-outdated-version-windows-media-player-6-work-after.html |url-status=live }}</ref> | |||
== Solutions<span class="anchor" id="Y2106"></span> == | == Solutions<span class="anchor" id="Y2106"></span> == | ||
There is no universal solution for the Year 2038 problem. For example, in the [[C (programming language)|C language]], any change to the definition of the <code>[[time_t]]</code> data type would result in [[binary-code compatibility|code-compatibility]] problems in any application in which date and time representations are dependent on the nature of the signed 32-bit <code>time_t</code> integer. Changing <code>time_t</code> to an unsigned 32-bit integer, which would extend the range to 2106<ref>{{cite web | url = https://sourceware.org/glibc/wiki/Y2038ProofnessDesign | title = DRAFT: Y2038 Proofness Design | access-date = 2024-05-25 | archive-date = 21 September 2019 | archive-url = https://web.archive.org/web/20190921231248/https://sourceware.org/glibc/wiki/Y2038ProofnessDesign | url-status = live }}</ref> (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 <code>time_t</code> type to 64 bits in an existing system would cause incompatible changes to the layout of structures and the binary interface of functions. | There is no universal solution for the Year 2038 problem. For example, in the [[C (programming language)|C language]], any change to the definition of the <code>[[time_t]]</code> data type would result in [[binary-code compatibility|code-compatibility]] problems in any application in which date and time representations are dependent on the nature of the signed 32-bit <code>time_t</code> integer. Changing <code>time_t</code> to an unsigned 32-bit integer, which would extend the range to 2106<ref>{{cite web | url = https://sourceware.org/glibc/wiki/Y2038ProofnessDesign | title = DRAFT: Y2038 Proofness Design | access-date = 2024-05-25 | archive-date = 21 September 2019 | archive-url = https://web.archive.org/web/20190921231248/https://sourceware.org/glibc/wiki/Y2038ProofnessDesign | url-status = live }}</ref> (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 <code>time_t</code> 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 architecture|hardware]] already use signed 64-bit <code>time_t</code> 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.<ref>{{ | Most operating systems designed to run on 64-bit [[hardware architecture|hardware]] already use signed 64-bit <code>time_t</code> 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.<ref>{{Cite web |last=Endrestøl |first=Trond |date=10 March 2015 |title=When does the 64-bit Unix time_t really end? |url=https://ximalas.info/2015/03/10/when-does-the-64-bit-unix-time_t-really-end/ |url-status=live |archive-url=https://web.archive.org/web/20220923220457/https://ximalas.info/2015/03/10/when-does-the-64-bit-unix-time_t-really-end/ |archive-date=23 September 2022 |access-date=2022-09-24 |website=Ximalas}}</ref> The ability to make [[computation]]s on dates is limited by the fact that <code>tm_year</code> 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).<ref>{{cite web|url=http://stablecross.com/files/End_Of_Time.html|date=17 April 2010|title=The End of Time|access-date=19 March 2012|first=Bob|last=Felts|website=Stablecross.com|archive-date=11 October 2012|archive-url=https://web.archive.org/web/20121011060328/http://stablecross.com/files/End_Of_Time.html|url-status=live}}</ref> | ||
Alternative proposals have been made (some of which are already in use), such as storing either [[millisecond]]s or [[microsecond]]s 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.<ref>{{cite web | Alternative proposals have been made (some of which are already in use), such as storing either [[millisecond]]s or [[microsecond]]s 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.<ref>{{cite web | ||
| Line 57: | Line 71: | ||
* [[FreeBSD]] uses 64-bit <code>time_t</code> for all 32-bit and 64-bit architectures except 32-bit i386, which uses signed 32-bit <code>time_t</code> instead.<ref>{{Cite web|url=https://www.freebsd.org/cgi/man.cgi?arch|title=arch|website=www.freebsd.org|access-date=26 September 2018|archive-date=26 September 2018|archive-url=https://web.archive.org/web/20180926205510/https://www.freebsd.org/cgi/man.cgi?arch|url-status=live}}</ref> | * [[FreeBSD]] uses 64-bit <code>time_t</code> for all 32-bit and 64-bit architectures except 32-bit i386, which uses signed 32-bit <code>time_t</code> instead.<ref>{{Cite web|url=https://www.freebsd.org/cgi/man.cgi?arch|title=arch|website=www.freebsd.org|access-date=26 September 2018|archive-date=26 September 2018|archive-url=https://web.archive.org/web/20180926205510/https://www.freebsd.org/cgi/man.cgi?arch|url-status=live}}</ref> | ||
* 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 <code>time_t</code>. Since it was a new environment, there was no need for special compatibility precautions.<ref name="Pondering2038" /> | * 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 <code>time_t</code>. Since it was a new environment, there was no need for special compatibility precautions.<ref name="Pondering2038" /> | ||
* [[Network File System]] version 4 has defined its time fields as <code>struct nfstime4 {int64_t seconds; uint32_t nseconds;}</code> since December 2000.<ref>{{cite IETF|rfc=7530|title=Network File System (NFS) Version 4 Protocol|section=2.2|sectionname=Structured Data Types|date=March 2015|editor1-first=Thomas|editor1-last=Haynes|editor2-first=David|editor2-last=Noveck}}</ref> Version 3 supports unsigned 32-bit values as <code>struct nfstime3 {uint32 seconds; uint32 nseconds;};</code>.<ref>{{cite web | url = https://datatracker.ietf.org/doc/html/rfc1813 | title= NFS Version 3 Protocol Specification | date= June 1995 | access-date = 2024-05-25 | last1= Staubach | first1= Peter | last2= Pawlowski | first2= Brian | last3= Callaghan | first3= Brent }}</ref> 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. | * [[Network File System]] version 4 has defined its time fields as <code>struct nfstime4 {int64_t seconds; uint32_t nseconds;}</code> since December 2000.<ref>{{cite IETF|rfc=7530|title=Network File System (NFS) Version 4 Protocol|section=2.2|sectionname=Structured Data Types|date=March 2015|editor1-first=Thomas|editor1-last=Haynes|editor2-first=David|editor2-last=Noveck}}</ref> Version 3 supports unsigned 32-bit values as <code>struct nfstime3 {uint32 seconds; uint32 nseconds;};</code>.<ref>{{cite web | url= https://datatracker.ietf.org/doc/html/rfc1813 | title= NFS Version 3 Protocol Specification | date= June 1995 | access-date= 2024-05-25 | last1= Staubach | first1= Peter | last2= Pawlowski | first2= Brian | last3= Callaghan | first3= Brent | archive-date= 15 May 2024 | archive-url= https://web.archive.org/web/20240515141645/https://datatracker.ietf.org/doc/html/rfc1813 | url-status= live }}</ref> 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.<ref>{{cite web|url=https://www.kernel.org/doc/html/latest/filesystems/ext4/dynamic.html#inode-timestamps|title=ext4 Data Structures and Algorithms|access-date=2022-09-13|archive-date=13 September 2022|archive-url=https://web.archive.org/web/20220913224855/https://www.kernel.org/doc/html/latest/filesystems/ext4/dynamic.html#inode-timestamps|url-status=live}}</ref> | * 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.<ref>{{cite web|url=https://www.kernel.org/doc/html/latest/filesystems/ext4/dynamic.html#inode-timestamps|title=ext4 Data Structures and Algorithms|access-date=2022-09-13|archive-date=13 September 2022|archive-url=https://web.archive.org/web/20220913224855/https://www.kernel.org/doc/html/latest/filesystems/ext4/dynamic.html#inode-timestamps|url-status=live}}</ref> | ||
* The [[XFS]] filesystem, starting with Linux 5.10, has an optional "big timestamps" feature which extends the timestamp range to the year 2486.<ref>{{cite web|url=https://www.phoronix.com/news/XFS-Linux-5.10|title=XFS File-System With Linux 5.10 Punts Year 2038 Problem To The Year 2486|author=Michael Larabel|website=[[Phoronix]]|date=15 October 2020|access-date=2022-09-13|archive-date=13 September 2022|archive-url=https://web.archive.org/web/20220913232215/https://www.phoronix.com/news/XFS-Linux-5.10|url-status=live}}</ref> | * The [[XFS]] filesystem, starting with Linux 5.10, has an optional "big timestamps" feature which extends the timestamp range to the year 2486.<ref>{{cite web|url=https://www.phoronix.com/news/XFS-Linux-5.10|title=XFS File-System With Linux 5.10 Punts Year 2038 Problem To The Year 2486|author=Michael Larabel|website=[[Phoronix]]|date=15 October 2020|access-date=2022-09-13|archive-date=13 September 2022|archive-url=https://web.archive.org/web/20220913232215/https://www.phoronix.com/news/XFS-Linux-5.10|url-status=live}}</ref> | ||
* While the native APIs of [[OpenVMS]] can support timestamps up to 31 July 31086,<ref name="Crazy time, Stanford, 1997">{{Cite web|date=1997-07-24|title=Why is Wednesday, November 17, 1858 the base time for OpenVMS (VAX VMS)?|url=https://www.slac.stanford.edu/~rkj/crazytime.txt|url-status=live|archive-url=https://web.archive.org/web/19970724202734/https://www.slac.stanford.edu/~rkj/crazytime.txt|archive-date=1997-07-24|access-date=2020-01-08|website=[[Stanford University]]|df=dmy-all}}</ref> the C runtime library (CRTL) uses 32-bit integers for <code>time_t</code>.<ref name="vsi-c-rtl">{{cite web|date=November 2020|title=VSI C Run-Time Library Reference Manual for OpenVMS Systems|url=https://vmssoftware.com/docs/VSI_CRTL_REF.pdf|access-date=2021-04-17|publisher=VSI|archive-date=17 April 2021|archive-url=https://web.archive.org/web/20210417113107/https://vmssoftware.com/docs/VSI_CRTL_REF.pdf|url-status=dead}}</ref> 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 <code>time_t</code> up to 7 February 2106.<ref>{{cite web|title=OpenVMS and the year 2038|url=https://www.zx.net.nz/mirror/h71000.www7.hp.com/2038.html|access-date=2021-04-17|publisher=HP|archive-date=17 April 2021|archive-url=https://web.archive.org/web/20210417113108/https://www.zx.net.nz/mirror/h71000.www7.hp.com/2038.html|url-status=live}}</ref> | * While the native APIs of [[OpenVMS]] can support timestamps up to 31 July 31086,<ref name="Crazy time, Stanford, 1997">{{Cite web|date=1997-07-24|title=Why is Wednesday, November 17, 1858 the base time for OpenVMS (VAX VMS)?|url=https://www.slac.stanford.edu/~rkj/crazytime.txt|url-status=live|archive-url=https://web.archive.org/web/19970724202734/https://www.slac.stanford.edu/~rkj/crazytime.txt|archive-date=1997-07-24|access-date=2020-01-08|website=[[Stanford University]]|df=dmy-all}}</ref> the C runtime library (CRTL) uses 32-bit integers for <code>time_t</code>.<ref name="vsi-c-rtl">{{cite web|date=November 2020|title=VSI C Run-Time Library Reference Manual for OpenVMS Systems|url=https://vmssoftware.com/docs/VSI_CRTL_REF.pdf|access-date=2021-04-17|publisher=VSI|archive-date=17 April 2021|archive-url=https://web.archive.org/web/20210417113107/https://vmssoftware.com/docs/VSI_CRTL_REF.pdf|url-status=dead}}</ref> 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 <code>time_t</code> up to 7 February 2106.<ref>{{cite web|title=OpenVMS and the year 2038|url=https://www.zx.net.nz/mirror/h71000.www7.hp.com/2038.html|access-date=2021-04-17|publisher=HP|archive-date=17 April 2021|archive-url=https://web.archive.org/web/20210417113108/https://www.zx.net.nz/mirror/h71000.www7.hp.com/2038.html|url-status=live}}</ref> | ||
* As of [[MySQL]] 8.0.28, released in January 2022, the functions <code>FROM_UNIXTIME()</code>, <code>UNIX_TIMESTAMP()</code>, and <code>CONVERT_TZ()</code> handle 64-bit values on platforms that support them. This includes 64-bit versions of Linux, macOS, and Windows.<ref>{{cite web|title=What Is New in MySQL 8.0|url=https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html#mysql-nutshell-additions|website=dev.mysql.com}}</ref><ref>{{cite web|title=Changes in MySQL 8.0.28 (2022-01-18, General Availability)|url=https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-28.html|website=dev.mysql.com|access-date=14 May 2024|archive-date=8 December 2023|archive-url=https://web.archive.org/web/20231208180456/https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-28.html|url-status=live}}</ref> In older versions, built-in functions like <code>UNIX_TIMESTAMP()</code> will return 0 after 03:14:07 [[UTC]] on 19 January 2038.<ref>{{cite web|title=MySQL Bugs: #12654: 64-bit unix timestamp is not supported in MySQL functions|url=https://bugs.mysql.com/bug.php?id=12654|website=bugs.mysql.com|access-date=28 March 2017|archive-date=29 March 2017|archive-url=https://web.archive.org/web/20170329045924/https://bugs.mysql.com/bug.php?id=12654|url-status=live}}</ref> | * As of [[MySQL]] 8.0.28, released in January 2022, the functions <code>FROM_UNIXTIME()</code>, <code>UNIX_TIMESTAMP()</code>, and <code>CONVERT_TZ()</code> handle 64-bit values on platforms that support them. This includes 64-bit versions of Linux, macOS, and Windows.<ref>{{cite web|title=What Is New in MySQL 8.0|url=https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html#mysql-nutshell-additions|website=dev.mysql.com|access-date=13 November 2021|archive-date=13 November 2021|archive-url=https://web.archive.org/web/20211113163225/https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html#mysql-nutshell-additions|url-status=live}}</ref><ref>{{cite web|title=Changes in MySQL 8.0.28 (2022-01-18, General Availability)|url=https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-28.html|website=dev.mysql.com|access-date=14 May 2024|archive-date=8 December 2023|archive-url=https://web.archive.org/web/20231208180456/https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-28.html|url-status=live}}</ref> In older versions, built-in functions like <code>UNIX_TIMESTAMP()</code> will return 0 after 03:14:07 [[UTC]] on 19 January 2038.<ref>{{cite web|title=MySQL Bugs: #12654: 64-bit unix timestamp is not supported in MySQL functions|url=https://bugs.mysql.com/bug.php?id=12654|website=bugs.mysql.com|access-date=28 March 2017|archive-date=29 March 2017|archive-url=https://web.archive.org/web/20170329045924/https://bugs.mysql.com/bug.php?id=12654|url-status=live}}</ref> | ||
* As of [[MariaDB]] 11.5.1, released in May 2024, the data type <code>TIMESTAMP</code> and functions <code>FROM_UNIXTIME()</code>, <code>UNIX_TIMESTAMP()</code>, and <code>CONVERT_TZ()</code> handle unsigned 32-bit values on 64-bit versions of Linux, macOS, and Windows.<ref>{{Cite web|url=https://mariadb.com/kb/en/mariadb-11-5-1-release-notes/|title=MariaDB 11.5.1 Release Notes|website=MariaDB KnowledgeBase}}</ref> 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. | * As of [[MariaDB]] 11.5.1, released in May 2024, the data type <code>TIMESTAMP</code> and functions <code>FROM_UNIXTIME()</code>, <code>UNIX_TIMESTAMP()</code>, and <code>CONVERT_TZ()</code> handle unsigned 32-bit values on 64-bit versions of Linux, macOS, and Windows.<ref>{{Cite web|url=https://mariadb.com/kb/en/mariadb-11-5-1-release-notes/|title=MariaDB 11.5.1 Release Notes|website=MariaDB KnowledgeBase|access-date=6 September 2024|archive-date=7 September 2024|archive-url=https://web.archive.org/web/20240907204506/https://mariadb.com/kb/en/mariadb-11-5-1-release-notes/|url-status=live}}</ref> 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 <code>time_t</code> unless the <code>_USE_32BIT_TIME_T</code> preprocessor macro is defined.<ref>{{Cite web |last= |date=2023-05-25 |title=Microsoft C/C++ change history 2003 - 2015 |url=https://learn.microsoft.com/en-us/cpp/porting/visual-cpp-change-history-2003-2015 |access-date=2024-08-13 |website=learn.microsoft.com |language=en-us}}</ref> However, the [[Windows API]] itself is unaffected by the year 2038 bug, as [[Microsoft Windows|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 [[Time formatting and storage bugs# | * Starting with [[Visual C++]] 2005, the CRT uses a 64-bit <code>time_t</code> unless the <code>_USE_32BIT_TIME_T</code> preprocessor macro is defined.<ref>{{Cite web |last= |date=2023-05-25 |title=Microsoft C/C++ change history 2003 - 2015 |url=https://learn.microsoft.com/en-us/cpp/porting/visual-cpp-change-history-2003-2015 |access-date=2024-08-13 |website=learn.microsoft.com |language=en-us}}</ref> However, the [[Windows API]] itself is unaffected by the year 2038 bug, as [[Microsoft Windows|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 [[Time formatting and storage bugs#Years 29,228 and 30,828|30,828]].<ref>{{Cite web |last= |date=2021-01-07 |title=About Time - Win32 apps |url=https://learn.microsoft.com/en-us/windows/win32/sysinfo/about-time |access-date=2024-08-13 |website=learn.microsoft.com |language=en-us}}</ref> | ||
* 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.<ref>{{Cite web|url=https://dosbox-x.com/release-2025.02.01.html|title=DOSBox-X 2025.02.01 Release Notes|access-date=19 August 2025|author=Jon Campbell|archive-date=23 April 2025|archive-url=https://web.archive.org/web/20250423024338/https://dosbox-x.com/release-2025.02.01.html|url-status=live}}</ref> | |||
* 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 <code>_USE_32BIT_TIME_T</code>, and it has not been allowed when building with 64-bit versions of Visual Studio.<ref name=gmtimelearn/> | |||
* 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. | |||
== See also == | == See also == | ||
* [[Time formatting and storage bugs]] lists other similar problems, often caused by rollover similar to the cause of this year 2038 problem. | * [[Time formatting and storage bugs]] lists other similar problems, often caused by rollover similar to the cause of this year 2038 problem. | ||
* A [[GPS week number rollover]] will coincidentally happen later in 2038, for a different reason | * A [[GPS week number rollover#2038 occurrence|GPS week number rollover]] will coincidentally happen later in 2038, but for a different reason. | ||
* A rollover in [[Network Time Protocol]] version 3 and earlier in 2036 is very similar to the 2038 problem, but is not identical. | |||
== Notes == | == Notes == | ||
| Line 76: | Line 96: | ||
== External links == | == External links == | ||
*[https://sourceware.org/glibc/wiki/Y2038ProofnessDesign Y2038 Proofness Design] [[GNU C Library|glibc]] Wiki | * [https://sourceware.org/glibc/wiki/Y2038ProofnessDesign Y2038 Proofness Design] [[GNU C Library|glibc]] Wiki | ||
*[https://computer.howstuffworks.com/question75.htm Entry in How Stuff Works] | * [https://computer.howstuffworks.com/question75.htm Entry in How Stuff Works] | ||
*[http://maul.deepsky.com/%7Emerovech/2038.html The Project 2038 Frequently Asked Questions] | * [http://maul.deepsky.com/%7Emerovech/2038.html The Project 2038 Frequently Asked Questions] | ||
*[https://people.cs.nctu.edu.tw/~tsaiwn/sisc/runtime_error_200_div_by_0/www.merlyn.demon.co.uk/critdate.htm#Y2038 ''Critical and Significant Dates'' 2038] | * [https://people.cs.nctu.edu.tw/~tsaiwn/sisc/runtime_error_200_div_by_0/www.merlyn.demon.co.uk/critdate.htm#Y2038 ''Critical and Significant Dates'' 2038] {{Webarchive|url=https://web.archive.org/web/20201107074104/https://people.cs.nctu.edu.tw/~tsaiwn/sisc/runtime_error_200_div_by_0/www.merlyn.demon.co.uk/critdate.htm#Y2038 |date=7 November 2020 }} | ||
*[https://github.com/evalEmpire/y2038/wiki A 2038-safe replacement for time.h on 32 bit systems] | * [https://github.com/evalEmpire/y2038/wiki A 2038-safe replacement for time.h on 32 bit systems] | ||
*{{Cite web |title=Solving the Year 2038 problem in the Linux kernel |url=https://opensource.com/article/19/1/year2038-problem-linux-kernel }} | * {{Cite web |title=Solving the Year 2038 problem in the Linux kernel |url=https://opensource.com/article/19/1/year2038-problem-linux-kernel }} | ||
*{{cite news |url=https://www.bbc.com/future/article/20150505-the-numbers-that-lead-to-disaster |title=The number glitch that can lead to catastrophe |work=BBC Future |first=Chris |last=Baraniuk |date=5 May 2015}} | * {{cite news |url=https://www.bbc.com/future/article/20150505-the-numbers-that-lead-to-disaster |title=The number glitch that can lead to catastrophe |work=BBC Future |first=Chris |last=Baraniuk |date=5 May 2015}} | ||
* {{cite web|last=Clewett|first=James|title=2,147,483,647 – The End of Time [Unix]|url=http://www.numberphile.com/videos/unix_time.html|website=Numberphile|publisher=[[Brady Haran]]|access-date=7 April 2013|archive-url=https://web.archive.org/web/20170522031114/http://www.numberphile.com/videos/unix_time.html|archive-date=22 May 2017|url-status=dead}} | * {{cite web|last=Clewett|first=James|title=2,147,483,647 – The End of Time [Unix]|url=http://www.numberphile.com/videos/unix_time.html|website=Numberphile|publisher=[[Brady Haran]]|access-date=7 April 2013|archive-url=https://web.archive.org/web/20170522031114/http://www.numberphile.com/videos/unix_time.html|archive-date=22 May 2017|url-status=dead}} | ||
Latest revision as of 04:08, 4 December 2025
The year 2038 problem (also known as Y2038,[1] Y2K38, Y2K38 superbug, or the Epochalypse[2][3]) 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. The data type is only capable of representing integers between −(231) and 231 − 1, meaning the latest time that can be properly encoded is 231 − 1 seconds after epoch (03:14:07 UTC on 19 January 2038). Attempting to increment to the following second (03:14:08) will cause the integer to overflow, setting its value to −(231) which systems will interpret as 231 seconds before epoch (20:45:52 UTC on 13 December 1901). Systems using unsigned 32-bit integers will overflow in 2106. 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.[4][5] The most vulnerable systems are those which are infrequently or never updated, such as legacy and embedded systems. Modern systems and software updates to legacy systems address this problem by using signed 64-bit integers instead of 32-bit integers, which will take 292 billion years to overflow—approximately 21 times the estimated age of the universe.[6]
Cause
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.Template:Efn 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 (Script error: No such module "val".) Template:Efn seconds after epoch, which is 03:14:07 UTC on 19 January 2038.[7] 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
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
UNIX_TIMESTAMP()-like commands. - Many 32-bit Android devices on Android 4 or earlier, including ZTE Blade,[8] Google Nexus 7[9] and 2012 Toshiba Android tablets.[10]
- OS X-era PowerPC Macs will have their system clock get stuck on the rollover time as of Mac OS X Tiger.[11]
- 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.[12]
- 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 skips ahead to April 12, 2160, and the date options in Windows 10's main settings menu does not show any selectable numbers.[13]
- Software built with Visual Studio has the
_gmtime32format (which serves as a mapping oftime_t'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_gmtimecorrespond to_gmtime32, and the correspondence can be forced when building with 32-bit versions of Visual Studio through Visual Studio 2019 by specifying_USE_32BIT_TIME_T.[14]
Embedded systems
Embedded systems that use dates for either computation or diagnostic logging are most likely to be affected by the Y2038 problem.[1] 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.Template:Efn
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).[15]
Early problems
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.[4][5]
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.[16]
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.[17] 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 gmtime_r() call cannot convert the number provided to a date to write to the cookie.[18]
Some versions of Windows Media Player Legacy refuse to run or be set up if the system time is on or after January 1, 2038.[19]
Solutions
There is no universal solution for the Year 2038 problem. For example, in the C language, any change to the definition of the time_t 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 time_t integer. Changing time_t to an unsigned 32-bit integer, which would extend the range to 2106[20] (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 time_t 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 time_t 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.[21] The ability to make computations on dates is limited by the fact that tm_year 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).[22]
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.[23][24] 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 <templatestyles src="Template:Tooltip/styles.css" />292 million yearsScript error: No such module "Check for unknown parameters".. 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[25] 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,[26] by storing time in a signed 64-bit integer on systems with 32-bit
time_t.[27] - Starting with NetBSD version 6.0 (released in October 2012), the NetBSD operating system uses a 64-bit
time_tfor both 32-bit and 64-bit architectures. Applications that were compiled for an older NetBSD release with 32-bittime_tare supported via a binary compatibility layer, but such older applications will still suffer from the Y2038 problem.[28] - OpenBSD since version 5.5, released in May 2014, also uses a 64-bit
time_tfor both 32-bit and 64-bit architectures. In contrast to NetBSD, there is no binary compatibility layer. Therefore, applications expecting a 32-bittime_tand applications using anything different fromtime_tto store time values may break.[29] - Linux originally used a 64-bit
time_tfor 64-bit architectures only; the pure 32-bit ABI was not changed due to backward compatibility.[30] Starting with version 5.6 of 2020, 64-bittime_tis supported on 32-bit architectures, too. This was done primarily for the sake of embedded Linux systems.[31] - GNU C Library since version 2.34 (released August 2021), added support for using 64-bit
time_ton 32-bit platforms with appropriate Linux versions. This support can be activated by defining preprocessor macro_TIME_BITSto64when compiling source code.[32] - FreeBSD uses 64-bit
time_tfor all 32-bit and 64-bit architectures except 32-bit i386, which uses signed 32-bittime_tinstead.[33] - 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
time_t. Since it was a new environment, there was no need for special compatibility precautions.[30] - Network File System version 4 has defined its time fields as
struct nfstime4 {int64_t seconds; uint32_t nseconds;}since December 2000.[34] Version 3 supports unsigned 32-bit values asstruct nfstime3 {uint32 seconds; uint32 nseconds;};.[35] 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.[36]
- The XFS filesystem, starting with Linux 5.10, has an optional "big timestamps" feature which extends the timestamp range to the year 2486.[37]
- While the native APIs of OpenVMS can support timestamps up to 31 July 31086,[38] the C runtime library (CRTL) uses 32-bit integers for
time_t.[39] 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 oftime_tup to 7 February 2106.[40] - As of MySQL 8.0.28, released in January 2022, the functions
FROM_UNIXTIME(),UNIX_TIMESTAMP(), andCONVERT_TZ()handle 64-bit values on platforms that support them. This includes 64-bit versions of Linux, macOS, and Windows.[41][42] In older versions, built-in functions likeUNIX_TIMESTAMP()will return 0 after 03:14:07 UTC on 19 January 2038.[43] - As of MariaDB 11.5.1, released in May 2024, the data type
TIMESTAMPand functionsFROM_UNIXTIME(),UNIX_TIMESTAMP(), andCONVERT_TZ()handle unsigned 32-bit values on 64-bit versions of Linux, macOS, and Windows.[44] 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
time_tunless the_USE_32BIT_TIME_Tpreprocessor macro is defined.[45] 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.[46] - 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.[47]
- 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
_USE_32BIT_TIME_T, and it has not been allowed when building with 64-bit versions of Visual Studio.[14] - 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.
See also
- Time formatting and storage bugs lists other similar problems, often caused by rollover similar to the cause of this year 2038 problem.
- A GPS week number rollover will coincidentally happen later in 2038, but for a different reason.
- A rollover in Network Time Protocol version 3 and earlier in 2036 is very similar to the 2038 problem, but is not identical.
Notes
References
<templatestyles src="Reflist/styles.css" />
- ↑ a b Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ a b Script error: No such module "citation/CS1".
- ↑ a b Weird "memory leak" problem in AOLserver 3.4.2/3.x Template:Webarchive 12 May 2006
- ↑ 263 seconds ÷ 60 seconds/minute ÷ 60 minutes/hour ÷ 24 hours/day ÷ (146097 days/400 years =) 365.2425 days/Gregorian year [≈ 292.277 billion (Gregorian) years] ÷ 13.79 billion years ≈ 21.19 times the estimated age of the universe after midnight UTC on January 1, 1970, neglecting leap seconds.
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ a b Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ a b Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Template:Cite IETF
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
Script error: No such module "Check for unknown parameters".
External links
- Y2038 Proofness Design glibc Wiki
- Entry in How Stuff Works
- The Project 2038 Frequently Asked Questions
- Critical and Significant Dates 2038 Template:Webarchive
- A 2038-safe replacement for time.h on 32 bit systems
- Script error: No such module "citation/CS1".
- Script error: No such module "citation/CS1".
- Script error: No such module "citation/CS1".