Re: [PATCH v3 2/2] feature_test_macros.7: document _TIME_BITS (time64)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/13/22 22:58, Sam James wrote:
Some notes:
* glibc is the only libc I'm aware of implementing _TIME_BITS for time64
compatibility. It was introduced in glibc-2.34;

* musl libc made a hard switch in 1.2.0, see https://musl.libc.org/time64.html;

* Using _TIME_BITS=64 with glibc requires _FILE_OFFSET_BITS=64 (which is used
for Large File Support)! Extraordinary claims require (some) evidence, so see
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/features-time64.h;h=84d56ee3ff2ecfa0d2499385623f30606f84a1bf.

Reference: https://wiki.gentoo.org/wiki/Project:Toolchain/time64_migration
Reference: https://sourceware.org/pipermail/libc-alpha/2022-January/134985.html
Signed-off-by: Sam James <sam@xxxxxxxxxx>

Patch applied.

Thanks,
Alex

---
  man7/feature_test_macros.7 | 15 +++++++++++++++
  1 file changed, 15 insertions(+)

diff --git a/man7/feature_test_macros.7 b/man7/feature_test_macros.7
index cdd962f7f..bcd6e6ae9 100644
--- a/man7/feature_test_macros.7
+++ b/man7/feature_test_macros.7
@@ -412,6 +412,17 @@ large files with only a recompilation being required.)
  64-bit systems naturally permit file sizes greater than 2 Gigabytes,
  and on those systems this macro has no effect.
  .TP
+.B _TIME_BITS
+Defining this macro with the value 64
+changes the width of
+.BR time_t (3type)
+to 64-bit which allows handling of timestamps beyond
+2038.
+It is closely related to
+.B _FILE_OFFSET_BITS
+and depending on implementation, may require it set.
+This macro is available as of glibc 2.34.
+.TP
  .BR _BSD_SOURCE " (deprecated since glibc 2.20)"
  Defining this macro with any value causes header files to expose
  BSD-derived definitions.
@@ -854,6 +865,10 @@ main(int argc, char *argv[])
      printf("_FILE_OFFSET_BITS defined: %d\en", _FILE_OFFSET_BITS);
  #endif
+#ifdef _TIME_BITS
+    printf("_TIME_BITS defined: %d\en", _TIME_BITS);
+#endif
+
  #ifdef _BSD_SOURCE
      printf("_BSD_SOURCE defined\en");
  #endif

--
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux