Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Year 2038 problem
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== 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. 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 | url = https://ximalas.info/2015/03/10/when-does-the-64-bit-unix-time_t-really-end/ | title = When does the 64-bit Unix time_t really end? | access-date = 2022-09-24 | archive-date = 23 September 2022 | archive-url = https://web.archive.org/web/20220923220457/https://ximalas.info/2015/03/10/when-does-the-64-bit-unix-time_t-really-end/ | url-status = live }}</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 | url=http://unununium.org/articles/uuutime | archive-url=https://web.archive.org/web/20060408161959/http://unununium.org/articles/uuutime | archive-date=8 April 2006 |title=Unununium Time | access-date=19 November 2006}}</ref><ref>{{cite web | url=https://docs.oracle.com/javase/9/docs/api/java/lang/System.html#currentTimeMillis-- | title=Java API documentation for System.currentTimeMillis() | author=Sun Microsystems | access-date=29 September 2017 | archive-date=30 September 2017 | archive-url=https://web.archive.org/web/20170930040244/https://docs.oracle.com/javase/9/docs/api/java/lang/System.html#currentTimeMillis-- | url-status=live }}</ref> 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 {{tooltip|1=292 million years|2=The theoretical overflow date is 17 August 292278994, 07:12:55.807 UTC.}}. 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 second]]s. In particular, TAI64<ref>{{Cite web|url=http://cr.yp.to/libtai/tai64.html|title=TAI64|access-date=4 September 2012|archive-date=26 September 2012|archive-url=https://web.archive.org/web/20120926120001/http://cr.yp.to/libtai/tai64.html|url-status=live}}</ref> 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 (programming language)|Ruby]] version 1.9.2 (released on 18 August 2010), the bug with year 2038 is fixed,<ref>{{cite web|date=18 August 2010|title=Ruby 1.9.2 is released|url=https://www.ruby-lang.org/en/news/2010/08/18/ruby-1-9-2-released/|access-date=1 April 2022|archive-date=8 April 2022|archive-url=https://web.archive.org/web/20220408110503/https://www.ruby-lang.org/en/news/2010/08/18/ruby-1-9-2-released/|url-status=live}}</ref> by storing time in a signed 64-bit integer on systems with 32-bit <code>time_t</code>.<ref>{{Cite web |title=time.c: use 64bit arithmetic even on platforms with 32bit VALUE |website=[[GitHub]] |url=https://github.com/ruby/ruby/commit/cea57f8fff58d933cd7a452e9ee0745d5a7c7577 |access-date=3 November 2023 |archive-date=3 November 2023 |archive-url=https://web.archive.org/web/20231103040211/https://github.com/ruby/ruby/commit/cea57f8fff58d933cd7a452e9ee0745d5a7c7577 |url-status=live }}</ref> * Starting with [[NetBSD]] version 6.0 (released in October 2012), the NetBSD operating system uses a 64-bit <code>time_t</code> for both 32-bit and 64-bit architectures. Applications that were compiled for an older NetBSD release with 32-bit <code>time_t</code> are supported via a binary compatibility layer, but such older applications will still suffer from the Y2038 problem.<ref>{{cite web|date=17 October 2012|title=Announcing NetBSD 6.0|url=https://www.netbsd.org/releases/formal-6/NetBSD-6.0.html|access-date=18 January 2016|archive-date=15 January 2016|archive-url=https://web.archive.org/web/20160115091208/http://www.netbsd.org/releases/formal-6/NetBSD-6.0.html|url-status=live}}</ref> * [[OpenBSD]] since version 5.5, released in May 2014, also uses a 64-bit <code>time_t</code> for both 32-bit and 64-bit architectures. In contrast to [[NetBSD]], there is no binary compatibility layer. Therefore, applications expecting a 32-bit <code>time_t</code> and applications using anything different from <code>time_t</code> to store time values may break.<ref>{{cite web|date=1 May 2014|title=OpenBSD 5.5 released (May 1, 2014)|url=http://www.openbsd.org/plus55.html|access-date=18 January 2016|archive-date=22 December 2015|archive-url=https://web.archive.org/web/20151222005608/http://www.openbsd.org/plus55.html|url-status=live}}</ref> * [[Linux]] originally used a 64-bit <code>time_t</code> for 64-bit architectures only; the pure 32-bit [[Application binary interface|ABI]] was not changed due to backward compatibility.<ref name="Pondering2038">{{cite web|author=Jonathan Corbet|author-link=Jonathan Corbet|date=14 August 2013|title=Pondering 2038|url=https://lwn.net/Articles/563285/|url-status=live|archive-url=https://web.archive.org/web/20160304081847/https://lwn.net/Articles/563285/|archive-date=4 March 2016|access-date=9 March 2016|website=[[LWN.net]]}}</ref> Starting with version [[Linux kernel version history#Releases 5.x.y|5.6]] of 2020, 64-bit <code>time_t</code> is supported on 32-bit architectures, too. This was done primarily for the sake of [[Linux on embedded systems|embedded Linux]] systems.<ref>{{Cite web|title=LKML: Arnd Bergmann: [GIT PULL] y2038: core, driver and file system changes|url=https://lkml.org/lkml/2020/1/29/355?anz=web|access-date=2020-01-30|website=lkml.org|archive-date=14 February 2020|archive-url=https://web.archive.org/web/20200214070752/https://lkml.org/lkml/2020/1/29/355?anz=web|url-status=live}}</ref> * [[GNU C Library]] since version 2.34 (released August 2021), added support for using 64-bit <code>time_t</code> on 32-bit platforms with appropriate Linux versions. This support can be activated by defining preprocessor macro <code>_TIME_BITS</code> to <code>64</code> when compiling source code.<ref>{{cite web |last1=O'Donell |first1=Carlos |title=The GNU C Library version 2.34 is now available |url=https://sourceware.org/pipermail/libc-alpha/2021-August/129718.html |website=Sourceware |access-date=2024-04-30 |date=2021-08-02 |archive-date=30 April 2024 |archive-url=https://web.archive.org/web/20240430060406/https://sourceware.org/pipermail/libc-alpha/2021-August/129718.html |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" /> * [[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. * 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> * 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 [[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. * 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#Year 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>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)