Linux Manual Pages development
 help / color / mirror / Atom feed
* [PATCH v3 1/2] time_t.3type: reference _TIME_BITS (time64)
@ 2022-10-13 20:58 Sam James
  2022-10-13 20:58 ` [PATCH v3 2/2] feature_test_macros.7: document " Sam James
  2022-10-13 22:39 ` [PATCH v3 1/2] time_t.3type: reference " Alejandro Colomar
  0 siblings, 2 replies; 4+ messages in thread
From: Sam James @ 2022-10-13 20:58 UTC (permalink / raw)
  To: Alejandro Colomar, Michael Kerrisk; +Cc: linux-man, Sam James

Just like we do with _FILE_OFFSET_BITS in off_t.3type.

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@gentoo.org>
---
 man3type/time_t.3type | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/man3type/time_t.3type b/man3type/time_t.3type
index d40dd0c0d..9b8f07356 100644
--- a/man3type/time_t.3type
+++ b/man3type/time_t.3type
@@ -70,6 +70,12 @@ POSIX.1-2001 and later.
 POSIX.1-2001 and later.
 .PD
 .SH NOTES
+On some architectures,
+the width of
+.I time_t
+can be controlled with the feature test macro
+.BR _TIME_BITS .
+.PP
 .TP
 .I time_t
 The following headers also provide
-- 
2.38.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] feature_test_macros.7: document _TIME_BITS (time64)
  2022-10-13 20:58 [PATCH v3 1/2] time_t.3type: reference _TIME_BITS (time64) Sam James
@ 2022-10-13 20:58 ` Sam James
  2022-10-13 22:37   ` Alejandro Colomar
  2022-10-13 22:39 ` [PATCH v3 1/2] time_t.3type: reference " Alejandro Colomar
  1 sibling, 1 reply; 4+ messages in thread
From: Sam James @ 2022-10-13 20:58 UTC (permalink / raw)
  To: Alejandro Colomar, Michael Kerrisk; +Cc: linux-man, Sam James

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@gentoo.org>
---
 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
-- 
2.38.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 2/2] feature_test_macros.7: document _TIME_BITS (time64)
  2022-10-13 20:58 ` [PATCH v3 2/2] feature_test_macros.7: document " Sam James
@ 2022-10-13 22:37   ` Alejandro Colomar
  0 siblings, 0 replies; 4+ messages in thread
From: Alejandro Colomar @ 2022-10-13 22:37 UTC (permalink / raw)
  To: Sam James; +Cc: linux-man


[-- Attachment #1.1: Type: text/plain, Size: 2168 bytes --]

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@gentoo.org>

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] time_t.3type: reference _TIME_BITS (time64)
  2022-10-13 20:58 [PATCH v3 1/2] time_t.3type: reference _TIME_BITS (time64) Sam James
  2022-10-13 20:58 ` [PATCH v3 2/2] feature_test_macros.7: document " Sam James
@ 2022-10-13 22:39 ` Alejandro Colomar
  1 sibling, 0 replies; 4+ messages in thread
From: Alejandro Colomar @ 2022-10-13 22:39 UTC (permalink / raw)
  To: Sam James; +Cc: linux-man


[-- Attachment #1.1: Type: text/plain, Size: 1074 bytes --]

On 10/13/22 22:58, Sam James wrote:
> Just like we do with _FILE_OFFSET_BITS in off_t.3type.
> 
> 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@gentoo.org>

Patch applied.

Thanks,
Alex

> ---
>   man3type/time_t.3type | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/man3type/time_t.3type b/man3type/time_t.3type
> index d40dd0c0d..9b8f07356 100644
> --- a/man3type/time_t.3type
> +++ b/man3type/time_t.3type
> @@ -70,6 +70,12 @@ POSIX.1-2001 and later.
>   POSIX.1-2001 and later.
>   .PD
>   .SH NOTES
> +On some architectures,
> +the width of
> +.I time_t
> +can be controlled with the feature test macro
> +.BR _TIME_BITS .
> +.PP

This .PP was unnecessary, so I removed it.  Both PP and TP are 
paragraphing macros.  TP does what PP does and more.  See groff_man(7).

>   .TP
>   .I time_t
>   The following headers also provide

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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-13 22:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-13 20:58 [PATCH v3 1/2] time_t.3type: reference _TIME_BITS (time64) Sam James
2022-10-13 20:58 ` [PATCH v3 2/2] feature_test_macros.7: document " Sam James
2022-10-13 22:37   ` Alejandro Colomar
2022-10-13 22:39 ` [PATCH v3 1/2] time_t.3type: reference " Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox