All of lore.kernel.org
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
Cc: linux-man@vger.kernel.org
Subject: [PATCH 4/5] tm.3type: describe tm_zone, tm_gmtoff
Date: Tue, 19 Jul 2022 03:56:29 +0200	[thread overview]
Message-ID: <a8be8830890c50b1a36e9b7d20693c19c77ca4e5.1658195739.git.nabijaczleweli@nabijaczleweli.xyz> (raw)
In-Reply-To: <62c1b6748d2faa6263264b9fcaa064495357441b.1658195739.git.nabijaczleweli@nabijaczleweli.xyz>

[-- Attachment #1: Type: text/plain, Size: 3047 bytes --]

FreeBSD timezone(3) is V7 char *timezone(int zone, int dst),
our documentation would imply it's impossible to service this type of
system portably

Indeed, glibc defines them both, and they make more sense for most
use-cases than trying to use the globals

glibc cited for __USE_MISC, tm_zone invalidation is Debian 2.33-7
POSIX cited for XSI marking is Issue 7 TC2
CSRG CD #2 contains 4.3BSD-Tahoe with both members

This also fixes the multiple lies in man-pages 5.10 localtime(3),
which says only:
    The glibc version of struct tm has additional fields
        const char *tm_zone;      /* Timezone abbreviation */
    defined when _BSD_SOURCE was set before including <time.h>.
    This is a BSD extension, present in 4.3BSD-Reno.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
 man3/tm.3type | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/man3/tm.3type b/man3/tm.3type
index 1931d890d..8b6f8d9bf 100644
--- a/man3/tm.3type
+++ b/man3/tm.3type
@@ -25,8 +25,26 @@ Standard C library
 .BR "    int  tm_yday;" \
 "   /* Day of the year  [" 0 ", " 365 "] (Jan/01 = " 0 ") */"
 .BR "    int  tm_isdst;" "  /* Daylight savings flag */"
+
+.BR "    long tm_gmtoff;" " /* Seconds East of UTC */"
+.BR "    char*tm_zone;" "   /* Timezone abbreviation */"
 .B };
 .fi
+.PP
+.RS -4
+Feature Test Macro Requirements for glibc (see
+.BR feature_test_macros (7)):
+.RE
+.PP
+.IR tm_gmtoff ,
+.IR tm_zone :
+.nf
+.\" Guarded with __USE_MISC:
+    Since glibc 2.19:
+        _DEFAULT_SOURCE
+    Glibc 2.19 and earlier:
+        _BSD_SOURCE || _SVID_SOURCE
+.fi
 .SH DESCRIPTION
 Describes time, broken down into distinct components.
 .PP
@@ -35,6 +53,16 @@ describes wether daylight saving time is in effect at the time described.
 The value is positive if daylight saving time is in effect,
 zero if it is not,
 and negative if the information is not available.
+.PP
+.I tm_gmtoff
+is the difference, in seconds, of the timezone represented by this broken-down time and UTC
+(this is the reverse of
+.BR timezone (3)).
+.PP
+.I tm_zone
+is the equivalent of
+.BR tzname (3)
+for the timezone represented by this broken-down time.
 .SH VERSIONS
 In C90,
 .I tm_sec
@@ -48,10 +76,27 @@ in C99.
 .SH CONFORMING TO
 C90 and later;
 POSIX.1-2001 and later.
+.PP
+.IR tm_gmtoff " and " tm_zone
+originate from 4.3BSD-Tahoe.
 .SH NOTES
 .I tm_sec
 can represent a leap second with the value
 .BR 60 .
+.PP
+.BR timezone (3),
+as a variable, is an XSI extension \(em some systems provide the V7-compatible
+.\" FreeBSD
+.BR timezone ()
+function.
+The
+.I tm_gmtoff
+fields provides an alternative (with the opposite sign) for those systems.
+.PP
+.I tm_zone
+points to potentially-constant static storage and may be overriden on subsequent calls to
+.BR localtime (3)
+&a. (this, however, never happens under glibc).
 .SH SEE ALSO
 .BR ctime (3),
 .BR strftime (3),
-- 
2.30.2


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

  parent reply	other threads:[~2022-07-19  1:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19  1:56 [PATCH 1/5] tm.3type: tfix наб
2022-07-19  1:56 ` [PATCH 2/5] tm.3type: align ranges наб
2022-07-19 11:44   ` Alejandro Colomar
2022-07-19 14:14     ` наб
2022-07-19 14:25       ` Alejandro Colomar
2022-07-19  1:56 ` [PATCH 3/5] tm.3type: tm_year is year minus 1900, not since наб
2022-07-19 11:47   ` Alejandro Colomar
2022-07-19 11:50   ` Alejandro Colomar
2022-07-19  1:56 ` наб [this message]
2022-07-19 12:17   ` [PATCH 4/5] tm.3type: describe tm_zone, tm_gmtoff Alejandro Colomar
2022-07-19 12:19     ` Alejandro Colomar
2022-07-19 15:28     ` наб
2022-07-22  3:33     ` G. Branden Robinson
2022-07-22 10:57       ` Alejandro Colomar (man-pages)
2022-07-22 22:20         ` man(7) DS and DE macros (was: [PATCH 4/5] tm.3type: describe tm_zone, tm_gmtoff) G. Branden Robinson
2022-07-22 23:47           ` Alejandro Colomar
2022-07-19  1:58 ` [PATCH 5/5] ctime.3: remove struct tm vestigia наб
2022-07-19 12:18   ` Alejandro Colomar
2022-07-19 11:38 ` [PATCH 1/5] tm.3type: tfix Alejandro Colomar
2022-07-19 15:35 ` [PATCH v2 1/4] tm.3type: align ranges наб
2022-07-19 18:38   ` [PATCH v3 1/2] tm.3type: describe tm_zone, tm_gmtoff наб
2022-07-19 20:33     ` Alejandro Colomar
2022-07-19 21:36       ` наб
2022-07-19 22:09         ` Alejandro Colomar
2022-07-19 22:35     ` [PATCH v4 " наб
2022-07-19 22:36     ` [PATCH v4 2/2] ctime.3: remove struct tm vestigia наб
2022-07-20  8:30       ` Alejandro Colomar
2022-07-19 18:39   ` [PATCH v3 " наб
2022-07-19 15:35 ` [PATCH v2 2/4] tm.3type: widen member alignment to take up to const char * наб
2022-07-19 15:59   ` Alejandro Colomar
2022-07-19 15:35 ` [PATCH v2 3/4] tm.3type: describe tm_zone, tm_gmtoff наб
2022-07-19 17:11   ` Alejandro Colomar
2022-07-19 15:35 ` [PATCH v2 4/4] ctime.3: remove struct tm vestigia наб
2022-07-19 17:12   ` Alejandro Colomar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a8be8830890c50b1a36e9b7d20693c19c77ca4e5.1658195739.git.nabijaczleweli@nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=alx.manpages@gmail.com \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.