xref: /freebsd/crypto/krb5/doc/appdev/y2038.rst (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1Year 2038 considerations for uses of krb5_timestamp
2===================================================
3
4POSIX time values, which measure the number of seconds since January 1
51970, will exceed the maximum value representable in a signed 32-bit
6integer in January 2038.  This documentation describes considerations
7for consumers of the MIT krb5 libraries.
8
9Applications or libraries which use libkrb5 and consume the timestamps
10included in credentials or other structures make use of the
11:c:type:`krb5_timestamp` type.  For historical reasons, krb5_timestamp
12is a signed 32-bit integer, even on platforms where a larger type is
13natively used to represent time values.  To behave properly for time
14values after January 2038, calling code should cast krb5_timestamp
15values to uint32_t, and then to time_t::
16
17    (time_t)(uint32_t)timestamp
18
19Used in this way, krb5_timestamp values can represent time values up
20until February 2106, provided that the platform uses a 64-bit or
21larger time_t type.  This usage will also remain safe if a later
22version of MIT krb5 changes krb5_timestamp to an unsigned 32-bit
23integer.
24
25The GSSAPI only uses representations of time intervals, not absolute
26times.  Callers of the GSSAPI should require no changes to behave
27correctly after January 2038, provided that they use MIT krb5 release
281.16 or later.
29