mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Nikita Popov <nikita.ppv@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] Re: strftime %Z behavior with manually populated struct tm
Date: Wed, 12 Aug 2020 16:05:18 +0200	[thread overview]
Message-ID: <CAF+90c-S3VQNG98SOi6pDP5Adx7y1_jTGSMb1+g2Q2bHYB8q3w@mail.gmail.com> (raw)
In-Reply-To: <CAF+90c8MDdtAZEFX5Ga-Sds1HwnwRDqc6g3ySY8f_E-0HxhujA@mail.gmail.com>

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

On Wed, Aug 12, 2020 at 2:57 PM Nikita Popov <nikita.ppv@gmail.com> wrote:

> > I haven't checked, but I believe most implementations just print the
> > zone name from the current timezone, using tm_isdst to decide whether
> > to print the standard or daylight version of the name. This is
> > insufficient with zoneinfo for zones where the name changed over time,
> > where it would print the wrong name for historical times. So instead
> > we support printing any one of the zone names from the current zone,
> > if the tm_zone member points to one of them, and blank otherwise.
>
> You are right. I was under the impression that glibc uses tm_zone, but
> double checking the implementation right now, it doesn't. So the behavioral
> discrepancy here comes from the fact that musl checks tm_zone at all, not
> the other way around. Sorry for looking in the completely wrong direction
> here.
>

Nevermind, I just confused myself further here. glibc does use tm_zone,
with the following comment:

    /* The POSIX test suite assumes that setting
    the environment variable TZ to a new value before calling strftime()
    will influence the result (the %Z format) even if the information in
    TP is computed with a totally different time zone.
    This is bogus: though POSIX allows bad behavior like this,
    POSIX does not require it. Do the right thing instead. */
    zone = (const char *) tp->tm_zone;

Regards,
Nikita

[-- Attachment #2: Type: text/html, Size: 1955 bytes --]

  reply	other threads:[~2020-08-12 14:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-10 13:31 [musl] " Nikita Popov
2020-08-10 16:53 ` Rich Felker
2020-08-12 12:57 ` [musl] " Nikita Popov
2020-08-12 14:05   ` Nikita Popov [this message]
2020-08-12 15:17   ` Rich Felker

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=CAF+90c-S3VQNG98SOi6pDP5Adx7y1_jTGSMb1+g2Q2bHYB8q3w@mail.gmail.com \
    --to=nikita.ppv@gmail.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).