[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: new module 'tzname'
From: |
Bruno Haible |
Subject: |
Re: new module 'tzname' |
Date: |
Mon, 17 Jun 2024 15:47:33 +0200 |
Hi Paul,
In tzname.texi you added:
@item
This variable's contents are unreliable if you use a geographical
@env{TZ} setting like @code{TZ="America/Los_Angeles"}.
What do you mean by "unreliable"? I tested the values for this TZ
and for my local one, and tzname is reasonable — the same values on
all platforms (except native Windows, which does not support
geographical TZ values in the first place).
=================================== foo.c =============================
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
const char *tz = getenv ("TZ");
tzset ();
printf ("TZ=%s -> tzname[0]=\"%s\", tzname[1]=\"%s\"\n",
tz != NULL ? tz : "(null)",
tzname[0], tzname[1]);
return 0;
}
=======================================================================
Results:
TZ=Europe/Berlin ./a.out TZ=America/Los_Angeles
./a.out
glibc tzname[0]="CET", tzname[1]="CEST" tzname[0]="PST",
tzname[1]="PDT"
musl tzname[0]="CET", tzname[1]="CEST" tzname[0]="PST",
tzname[1]="PDT"
macOS 12 tzname[0]="CET", tzname[1]="CEST" tzname[0]="PST",
tzname[1]="PDT"
FreeBSD 14.0 tzname[0]="CET", tzname[1]="CEST" tzname[0]="PST",
tzname[1]="PDT"
NetBSD 10.0 tzname[0]="CET", tzname[1]="CEST" tzname[0]="PST",
tzname[1]="PDT"
OpenBSD 7.5 tzname[0]="CET", tzname[1]="CEST" tzname[0]="PST",
tzname[1]="PDT"
AIX 7.3 tzname[0]="CET", tzname[1]="CEST" tzname[0]="PST",
tzname[1]="PDT"
Solaris 11.4 tzname[0]="CET", tzname[1]="CEST" tzname[0]="PST",
tzname[1]="PDT"
Cygwin 3.4.6 tzname[0]="CET", tzname[1]="CEST" tzname[0]="PST",
tzname[1]="PDT"
So, what is the actual problem?
Does the problem only appear with specific TZ values? If so, what is the
most relevant such TZ value?
And is the problem related to the unification/overloading of time zones that
caused so many discussions in summer 2021?
Bruno
- Re: [PATCH 6/7] nstrftime, -0000, (continued)
- Re: [PATCH 6/7] nstrftime, time_rz: don’t depend on tzname, Bruno Haible, 2024/06/18
- Re: [PATCH 6/7] nstrftime, time_rz: don’t depend on tzname, Paul Eggert, 2024/06/18
- [PATCH 3/7] time: document struct tm portability, Paul Eggert, 2024/06/16
- [PATCH 7/7] nstrftime: omit never-used code, Paul Eggert, 2024/06/16
- Re: new module 'tzname', tm_zone and tm_gmtoff, Paul Eggert, 2024/06/16
- Re: new module 'tzname', tm_zone and tm_gmtoff, Bruno Haible, 2024/06/17
- Re: new module 'tzname', tm_zone and tm_gmtoff, Paul Eggert, 2024/06/17
- Re: new module 'tzname', tm_zone and tm_gmtoff, Paul Eggert, 2024/06/16
Re: new module 'tzname',
Bruno Haible <=