summaryrefslogtreecommitdiff
path: root/doc/year2038.texi
blob: abb7b54c842e55a7791f8285250b0b8e504f2c1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@node Avoiding the year 2038 problem
@section Avoiding the year 2038 problem

The ``year 2038 problem'' denotes unpredictable behaviour that will
likely occur in the year 2038, for programs that use a 32-bit signed
integer @samp{time_t} type that cannot represent timestamps on or
after 2038-01-19 03:14:08 UTC@.  See
@url{https://en.wikipedia.org/wiki/Year_2038_problem, Year 2038
problem} for details.

The Gnulib module @samp{year2038-required} fixes this problem, by
making @code{time_t} wide enough to represent timestamps after 2038.
This has no effect on most current systems, which have timestamps that
are already wide enough.  However, @samp{year2038-required} arranges
for builds on legacy 32-bit x86 and ARM Linux kernels running glibc
2.34 and later to compile with @samp{_TIME_BITS=64} to get wider
timestamps.  On older platforms that do not support timestamps after
the year 2038, @samp{year2038-required} causes @command{configure} to
fail.

With the @samp{year2038-required} module, @command{configure} fails
on the following 32-bit platforms (or ABIs in bi-arch systems):
@itemize
@item
Linux with glibc < 2.34 on
x86, arm, mips (32-bit or n32 ABI), powerpc, sparc, s390, hppa, m68k, sh, csky, microblaze, nios2,
@item
Linux/riscv32,
@item
Mac OS X on x86 and powerpc,
@item
GNU/Hurd/x86,
@item
GNU/kFreeBSD/x86,
@item
FreeBSD/x86,
@item
MidnightBSD/x86,
@item
AIX/powerpc,
@item
Solaris 10 and 11 on x86 and sparc,
@item
Cygwin/x86,
@item
Haiku/x86.
@end itemize

Whereas no failure will occur on the following 32-bit platforms or ABIs:
@itemize
@item
Linux/x86 with glibc >= 2.34 on
x86, arm, mips (32-bit or n32 ABI), powerpc, sparc, s390, hppa, m68k, sh, csky, microblaze, nios2,
@item
Linux/x86_64-x32,
@item
NetBSD on x86 and sparc,
@item
OpenBSD/x86,
@item
FreeBSD/arm,
@item
Minix 3.3.
@end itemize

The Gnulib module @samp{year2038} is like @samp{year2038-required},
except that it causes @command{configure} to fail only when it appears
that the current system should support post-2038 timestamps but
something prevents that from working.  Also, @samp{year2038} gives
@command{configure} a @option{--disable-year2038} option, which
suppresses support for post-2038 timestamps.  This may be useful if
the package links to other libraries whose user-facing ABIs still
require @code{time_t} to be 32-bit on your platform.

The Gnulib module @samp{year2038-required} is
recommended for any package that might be used after the year 2038 on
32-bit platforms.  However, if your package needs to support
platforms that will not be used after the year 2038,
you can use the @samp{year2038} module instead.

If the Gnulib module @samp{largefile} is used but neither
@samp{year2038} nor @samp{year2038-required} is used,
@command{configure} will have an option @option{--enable-year2038}
that causes @code{configure} to behave as if @samp{year2038} was used.
This is for packages that have long used @samp{largefile} but have not
gotten around to upgrade their Gnulib module list to include
@samp{year2038-required} or @samp{year2038}.
@xref{Large File Support}.