From: jdoubleu <hi@jdoubleu.de>
To: newlib@sourceware.org
Subject: Re: [PATCH] add tests for tzset(3)
Date: Fri, 15 Apr 2022 12:10:06 +0200 [thread overview]
Message-ID: <2a909d6a-cdfd-0642-68de-7082c9fb0e0a@jdoubleu.de> (raw)
In-Reply-To: <CAOox84vRZ8=o5jEEd9H9yxmCGse_ZDjX4ZmgVmu1diHmPw1_tw@mail.gmail.com>
On Thu, Apr 14, 2022 at 12:31 PM Brian Inglis wrote:
> I am still not hearing from where the requirement originates to set
> UTC/GMT/etc or do anything other than leave everything as is.
> Is this glibc behaviour, and why not /etc/localtime or /etc/timezone?
On 4/14/2022 9:23 PM, Jeff Johnston wrote:
> It is glibc behaviour as I mentioned in my note. The following is also
> from man tzset
Aside from glibc, the BSD man page[1] also states:
> If the TZ environment variable [..] cannot be interpreted as a direct specification, UTC is used.
Where "direct specification" is the formatted string.
The POSIX standard does not seem to explicitly state what happens in an
error case, besides[2]:
> The interpretation of these fields is unspecified if either field is less than three bytes [..], > more than {TZNAME_MAX} bytes, or if they contain characters other
than those specified.and[3]
> If TZ is absent from the environment, implementation-defined default timezone information shall be used.
[1]: https://man.openbsd.org/tzset
[2]:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tzset.html#
Cheers
---
🙎🏻♂️ jdoubleu
On 4/14/2022 9:23 PM, Jeff Johnston wrote:
> On Thu, Apr 14, 2022 at 12:31 PM Brian Inglis <
> Brian.Inglis@systematicsw.ab.ca> wrote:
>
>> I am still not hearing from where the requirement originates to set
>> UTC/GMT/etc or do anything other than leave everything as is.
>> Is this glibc behaviour, and why not /etc/localtime or /etc/timezone?
>>
>>
> It is glibc behaviour as I mentioned in my note. The following is also
> from man tzset
>
> If the TZ variable does not appear in the environment, the tzname
> vari‐
> able is initialized with the best approximation of local wall
> clock
> time, as specified by the tzfile(5)-format file localtime found in
> the
> system timezone directory (see below). (One also often
> sees
> /etc/localtime used here, a symlink to the right file in the
> system
> timezone directory.)
>
> If the TZ variable does appear in the environment but its value
> is
> empty or its value cannot be interpreted using any of the formats
> spec‐
> ified below, Coordinated Universal Time (UTC) is used.
>
> Note about if its value is specified and cannot be interpreted using any of
> the formats specified.
> If there is an error, then that clause would apply. In glibc's case, it is
> less than 3 chars and invalid
> chars. In our case, exceeding the max limit would also apply.
>
> From glibc: tzset.c
>
> /* Clear out old state and reset to unnamed UTC. */
> memset (tz_rules, '\0', sizeof tz_rules);
> tz_rules[0].name = tz_rules[1].name = "";
>
> /* Get the standard timezone name. */
> if (parse_tzname (&tz, 0) && parse_offset (&tz, 0))
>
> If the parse_tzname fails or parsing the dst name fails, unnamed UTC is
> used.
>
> -- Jeff J.
>
next prev parent reply other threads:[~2022-04-15 10:10 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 15:58 jdoubleu
2022-04-08 21:21 ` Jeff Johnston
2022-04-10 8:43 ` Dimitar Dimitrov
2022-04-10 17:55 ` jdoubleu
2022-04-10 21:00 ` Dimitar Dimitrov
2022-04-11 11:17 ` jdoubleu
2022-04-11 17:27 ` Dimitar Dimitrov
2022-04-12 11:19 ` jdoubleu
2022-04-12 18:33 ` Brian Inglis
2022-04-07 23:34 ` [PATCH v2 0/2] add tzset/_r POSIX angle bracket <> support in TZ env var Brian Inglis
2022-04-07 23:34 ` [PATCH v2 1/2] newlib/libc/time/tzset.c: doc update POSIX angle bracket <> support Brian Inglis
2022-04-07 23:34 ` [PATCH v2 2/2] newlib/libc/time/tzset_r.c(_tzset_unlocked_r): " Brian Inglis
2022-04-08 19:11 ` [PATCH v2 0/2] add tzset/_r POSIX angle bracket <> support in TZ env var Jeff Johnston
2022-04-13 17:53 ` [PATCH] add tests for tzset(3) Brian Inglis
2022-04-13 20:33 ` Jeff Johnston
2022-04-13 22:19 ` Brian Inglis
2022-04-14 8:59 ` jdoubleu
2022-04-14 16:31 ` Brian Inglis
2022-04-14 19:23 ` Jeff Johnston
2022-04-15 10:10 ` jdoubleu [this message]
2022-04-27 19:30 ` Jeff Johnston
2022-05-14 14:39 ` jdoubleu
2022-05-16 16:05 ` Dimitar Dimitrov
2022-05-16 17:38 ` Jeff Johnston
2022-05-17 8:45 ` [PATCH] update tzset tests jdoubleu
2022-05-18 18:48 ` Dimitar Dimitrov
2022-05-18 20:56 ` Keith Packard
2022-05-19 8:47 ` jdoubleu
2022-05-22 9:51 ` [PATCH v2] " jdoubleu
2022-05-22 21:02 ` Dimitar Dimitrov
2022-05-27 15:46 ` Jeff Johnston
2022-04-13 22:21 ` [PATCH] add tests for tzset(3) Brian Inglis
2022-04-29 15:46 Jeff Johnston
2022-05-12 18:35 ` jdoubleu
2022-05-16 17:49 ` Jeff Johnston
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=2a909d6a-cdfd-0642-68de-7082c9fb0e0a@jdoubleu.de \
--to=hi@jdoubleu.de \
--cc=newlib@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).