✘64-bit time_t on glibc 2.34 and up

Gary E. Miller gem at rellim.com
Fri Jan 13 21:19:27 UTC 2023


Yo Hal!

On Thu, 12 Jan 2023 23:15:25 -0800
Hal Murray <halmurray at sonic.net> wrote:

> gem at rellim.com said:
> > Recent glibc (2.34 and up) and recent Linux kernels, allow 64 bit
> > time_t on 32-bit Linux without much work.   
> 
> What does "without much work" mean?

See commit 19d76e95312b03028752d57e76098d56adac63d9

   #define _TIME_BITS 64
   #define _FILE_OFFSET_BITS 64

That's not much work.

> How does gcc/clang/whatever decide if it is using 32 or 64 bits for
> time_t?

gcc and clang do not care, what matters is sys/time.h.  That file
decides based on the presence, or abscense, of:

   #define _TIME_BITS 64
   #define _FILE_OFFSET_BITS 64

> What do I do if I want to use the one the distro didn't pick?

You do nothing that you did not already always do: use time.h

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 851 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20230113/ef5355aa/attachment.bin>


More information about the devel mailing list