TZ="" now always means UTC without leap seconds.
This agrees better with doc and with tzcode,
where TZ="" is intended to be a performance hack.
* manual/time.texi (TZ Variable): Clarify that TZ=":" is equivalent
to TZ="", and that both mean UTC without leap seconds.
* time/tzfile.c (__tzfile_read): Check for TZ="" here,
so that __use_tzfile is set properly.
* time/tzset.c (tzset_internal): Simplify by relying on
__tzfile_read to check for TZ="".
---
NEWS | 7 +++++++
manual/time.texi | 10 +++++-----
time/tzfile.c | 3 +++
time/tzset.c | 13 +++----------
timezone/test-tz.c | 1 +
5 files changed, 19 insertions(+), 15 deletions(-)
@@ -90,6 +90,13 @@ Deprecated and removed features, and other changes affecting compatibility:
/usr/share/zoneinfo/posixrules but this did not work and in practice
posixrules invariably specified the US rule anyway.
+* TZ="" now always agrees with TZ=":" and means UTC without leap seconds.
+ Previously TZ="" meant UTC with leap seconds on the rare systems
+ configured to use leap seconds by default. However, this behavior
+ disagreed with both the glibc manual (which said that TZ="" and TZ=":"
+ have the same behavior) and with tzcode upstream, and it did not work
+ in some cases.
+
Changes to build and runtime requirements:
* On recent Linux kernels with vDSO getrandom support, getrandom does not
@@ -2642,6 +2642,10 @@ EST+5EDT,M3.2.0/2,M11.1.0/2
<-02>+2<-01>,M3.5.0/-1,M10.5.0/0
@end smallexample
+@item
+As an extension to POSIX, when the value of @env{TZ} is the empty string,
+@theglibc{} uses UTC without leap seconds.
+
@item
The @dfn{colon format} begins with @samp{:}. Here is an example.
@@ -2652,11 +2656,7 @@ The @dfn{colon format} begins with @samp{:}. Here is an example.
@noindent
Each operating system can interpret this format differently;
in @theglibc{}, the @samp{:} is ignored and @var{characters}
-are treated as if they specified the geographical or proleptic format.
-
-@item
-As an extension to POSIX, when the value of @env{TZ} is the empty string,
-@theglibc{} uses UTC.
+are treated as if they specified one of the other formats.
@end itemize
@pindex /etc/localtime
@@ -172,6 +172,9 @@ __tzfile_read (const char *file)
if (*file != '/')
{
+ if (*file == '\0')
+ goto ret_free_transitions;
+
const char *tzdir;
tzdir = getenv ("TZDIR");
@@ -399,10 +399,6 @@ tzset_internal (int always)
/* No user specification; use the site-wide default. */
tz = TZDEFAULT;
- if (*tz == '\0')
- /* User specified the empty string; use UTC explicitly. */
- tz = "Universal";
-
/* A leading colon means "implementation defined syntax".
We ignore the colon and always use the same algorithm:
try a data file, and if none exists parse the 1003.1 syntax. */
@@ -422,12 +418,9 @@ tzset_internal (int always)
old_tz = __strdup (tz);
/* Try to read a data file. */
- if (*tz != '\0')
- {
- __tzfile_read (tz);
- if (__use_tzfile)
- return;
- }
+ __tzfile_read (tz);
+ if (__use_tzfile)
+ return;
/* No data file found. Default to UTC if nothing specified or if
TZDEFAULT is broken. */
@@ -8,6 +8,7 @@ struct {
time_t expected;
} tests[] = {
{"MST", 832935315},
+ {":", 832910115},
{"", 832910115},
{":UTC", 832910115},
{"UTC", 832910115},