public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [Bug 218711] New: strftime man page incorrectly claims that TZ is used
@ 2024-04-11 19:44 bugzilla-daemon
  2024-04-11 21:55 ` Alejandro Colomar
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bugzilla-daemon @ 2024-04-11 19:44 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=218711

            Bug ID: 218711
           Summary: strftime man page incorrectly claims that TZ is used
           Product: Documentation
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: man-pages
          Assignee: documentation_man-pages@kernel-bugs.osdl.org
          Reporter: gharris@sonic.net
        Regression: No

The strftime man page says, in the ENVIRONMENT section, that "The environment
variables TZ and LC_TIME are used."

strftime(), in Linux, does not use the TZ environment variable.  It is passed a
pointer to a struct tm, which contains a time stamp that can reflect either
local time or UTC, and formats a string based on the values in that structure. 
If the structure reflects local time, there is no need for any conversion of
POSIX time to local time, so TZ is not used.  If the structure reflects UTC,
the string will reflect UTC, meaning that, again, there is no need for any
conversion to local time, so TZ is not used.

TZ is *indirectly* used, because, to quote the Single UNIX Specification page
for strftime(), "Local timezone information is used as though strftime() called
tzset().", and, to quote the Single UNIX Specification page for tzset(), "The
tzset() function shall use the value of the environment variable TZ to set time
conversion information used by ctime, localtime, mktime, and strftime."

The reason why strftime is mentioned is that the %Z format specifier is
"Replaced by the timezone name or abbreviation, or by no bytes if no timezone
information exists."  In systems in which struct tm includes the tm_zone
member, %Z can use the tm_zone member as the timezone abbreviation, but, in
systems where it does *not* include the tm_zone member, strftime() might, for
example, have to fall back on using the tzname[] array and the tm_isdst member
to select an element of that array.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

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

* Re: [Bug 218711] New: strftime man page incorrectly claims that TZ is used
  2024-04-11 19:44 [Bug 218711] New: strftime man page incorrectly claims that TZ is used bugzilla-daemon
@ 2024-04-11 21:55 ` Alejandro Colomar
  2024-04-11 21:55 ` [Bug 218711] " bugzilla-daemon
  2024-04-11 22:04 ` bugzilla-daemon
  2 siblings, 0 replies; 4+ messages in thread
From: Alejandro Colomar @ 2024-04-11 21:55 UTC (permalink / raw)
  To: bugzilla-daemon; +Cc: linux-man

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

On Thu, Apr 11, 2024 at 07:44:43PM +0000, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=218711
> 
>             Bug ID: 218711
>            Summary: strftime man page incorrectly claims that TZ is used
>            Product: Documentation
>            Version: unspecified
>           Hardware: All
>                 OS: Linux
>             Status: NEW
>           Severity: normal
>           Priority: P3
>          Component: man-pages
>           Assignee: documentation_man-pages@kernel-bugs.osdl.org
>           Reporter: gharris@sonic.net
>         Regression: No
> 
> The strftime man page says, in the ENVIRONMENT section, that "The environment
> variables TZ and LC_TIME are used."
> 
> strftime(), in Linux, does not use the TZ environment variable.  It is passed a
> pointer to a struct tm, which contains a time stamp that can reflect either
> local time or UTC, and formats a string based on the values in that structure. 
> If the structure reflects local time, there is no need for any conversion of
> POSIX time to local time, so TZ is not used.  If the structure reflects UTC,
> the string will reflect UTC, meaning that, again, there is no need for any
> conversion to local time, so TZ is not used.
> 
> TZ is *indirectly* used, because, to quote the Single UNIX Specification page
> for strftime(), "Local timezone information is used as though strftime() called
> tzset().", and, to quote the Single UNIX Specification page for tzset(), "The
> tzset() function shall use the value of the environment variable TZ to set time
> conversion information used by ctime, localtime, mktime, and strftime."
> 
> The reason why strftime is mentioned is that the %Z format specifier is
> "Replaced by the timezone name or abbreviation, or by no bytes if no timezone
> information exists."  In systems in which struct tm includes the tm_zone
> member, %Z can use the tm_zone member as the timezone abbreviation, but, in
> systems where it does *not* include the tm_zone member, strftime() might, for
> example, have to fall back on using the tzname[] array and the tm_isdst member
> to select an element of that array.

Hi Guy,

Would you mind sending a patch to the mailing list, according to the
guidelines?

<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING>.
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING.d/mail>
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING.d/patches>

It would be wise to CC Paul Eggert <eggert@cs.ucla.edu>.

Have a lovely day!
Alex

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

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

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

* [Bug 218711] strftime man page incorrectly claims that TZ is used
  2024-04-11 19:44 [Bug 218711] New: strftime man page incorrectly claims that TZ is used bugzilla-daemon
  2024-04-11 21:55 ` Alejandro Colomar
@ 2024-04-11 21:55 ` bugzilla-daemon
  2024-04-11 22:04 ` bugzilla-daemon
  2 siblings, 0 replies; 4+ messages in thread
From: bugzilla-daemon @ 2024-04-11 21:55 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=218711

--- Comment #1 from Alejandro Colomar (alx@kernel.org) ---
On Thu, Apr 11, 2024 at 07:44:43PM +0000, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=218711
> 
>             Bug ID: 218711
>            Summary: strftime man page incorrectly claims that TZ is used
>            Product: Documentation
>            Version: unspecified
>           Hardware: All
>                 OS: Linux
>             Status: NEW
>           Severity: normal
>           Priority: P3
>          Component: man-pages
>           Assignee: documentation_man-pages@kernel-bugs.osdl.org
>           Reporter: gharris@sonic.net
>         Regression: No
> 
> The strftime man page says, in the ENVIRONMENT section, that "The environment
> variables TZ and LC_TIME are used."
> 
> strftime(), in Linux, does not use the TZ environment variable.  It is passed
> a
> pointer to a struct tm, which contains a time stamp that can reflect either
> local time or UTC, and formats a string based on the values in that
> structure. 
> If the structure reflects local time, there is no need for any conversion of
> POSIX time to local time, so TZ is not used.  If the structure reflects UTC,
> the string will reflect UTC, meaning that, again, there is no need for any
> conversion to local time, so TZ is not used.
> 
> TZ is *indirectly* used, because, to quote the Single UNIX Specification page
> for strftime(), "Local timezone information is used as though strftime()
> called
> tzset().", and, to quote the Single UNIX Specification page for tzset(), "The
> tzset() function shall use the value of the environment variable TZ to set
> time
> conversion information used by ctime, localtime, mktime, and strftime."
> 
> The reason why strftime is mentioned is that the %Z format specifier is
> "Replaced by the timezone name or abbreviation, or by no bytes if no timezone
> information exists."  In systems in which struct tm includes the tm_zone
> member, %Z can use the tm_zone member as the timezone abbreviation, but, in
> systems where it does *not* include the tm_zone member, strftime() might, for
> example, have to fall back on using the tzname[] array and the tm_isdst
> member
> to select an element of that array.

Hi Guy,

Would you mind sending a patch to the mailing list, according to the
guidelines?

<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING>.
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING.d/mail>
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING.d/patches>

It would be wise to CC Paul Eggert <eggert@cs.ucla.edu>.

Have a lovely day!
Alex

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

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

* [Bug 218711] strftime man page incorrectly claims that TZ is used
  2024-04-11 19:44 [Bug 218711] New: strftime man page incorrectly claims that TZ is used bugzilla-daemon
  2024-04-11 21:55 ` Alejandro Colomar
  2024-04-11 21:55 ` [Bug 218711] " bugzilla-daemon
@ 2024-04-11 22:04 ` bugzilla-daemon
  2 siblings, 0 replies; 4+ messages in thread
From: bugzilla-daemon @ 2024-04-11 22:04 UTC (permalink / raw)
  To: linux-man

https://bugzilla.kernel.org/show_bug.cgi?id=218711

--- Comment #2 from Guy Harris (gharris@sonic.net) ---
> It would be wise to CC Paul Eggert <eggert@cs.ucla.edu>.

I'm not sure why, given that the tzdb newstrftime man page doesn't mention TZ. 
The tzdb strftime() *code* will use tm_zone if the code is configured to
support it, falls back on using tzname[] and tm_isdst if tzname[] is present,
and otherwise replace %Z with the empty string, so it's only directly affected
by the TZ setting if struct tm doesn't contain tm_zone.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

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

end of thread, other threads:[~2024-04-11 22:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-11 19:44 [Bug 218711] New: strftime man page incorrectly claims that TZ is used bugzilla-daemon
2024-04-11 21:55 ` Alejandro Colomar
2024-04-11 21:55 ` [Bug 218711] " bugzilla-daemon
2024-04-11 22:04 ` bugzilla-daemon

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