POSIX.1-2024 requires 64-bit time_t

Alejandro Colomar alx@kernel.org
Sun May 18 22:06:33 GMT 2025


Hi Mark,

On Sun, May 18, 2025 at 02:52:30PM -0700, Mark Harris wrote:
> For glibc, all 64-bit platforms, and the most recently added 32-bit
> platforms (arc, riscv32, or1k), use 64-bit time_t.  All older but
> still-supported 32-bit platforms (arm, csky, hppa, m68k, microblaze,
> mips, powerpc, s390, sh, sparc, x86) currently use 32-bit time_t by
> default but can use 64-bit time_t with -D_TIME_BITS=64.  For musl, all
> platforms use 64-bit time_t.

Thanks!

> POSIX.1-2024 requires that an implementation offer a conforming
> environment that supports 64-bit time_t, but it is also free to offer
> other non-conforming environments that use 32-bit time_t.

Are you sure?  That's not what I read from the standard.

POSIX.1-2024 says something like that for other types; for example:

	The implementation shall support one or more programming
	environments in which the widths of blksize_t, pid_t, size_t,
	ssize_t, and suseconds_t are no greater than the width of type
	long.

But for time_t it is very strict:

	time_t shall be an integer type with a width (see <stdint.h>) of
	at least 64 bits.

It doesn't seem to support such alternate environments for time_t.  Of
course, an implementation is free to not conform, but then it's a non-
conforming implementation.


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250519/d0648703/attachment-0001.sig>


More information about the Libc-alpha mailing list