Thread (8 messages) 8 messages, 4 authors, 2025-05-19

Re: POSIX.1-2024 requires 64-bit time_t

From: Alejandro Colomar <alx@kernel.org>
Date: 2025-05-18 22:06:36

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/>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help