summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
Diffstat (limited to 'time')
-rw-r--r--time/Makefile21
-rw-r--r--time/tzset.c15
2 files changed, 29 insertions, 7 deletions
diff --git a/time/Makefile b/time/Makefile
index ac422bfc42..5efb638c9e 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -64,7 +64,9 @@ installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
ifeq ($(cross-compiling),no)
# Don't try to install the zoneinfo files since we can't run zic.
-install-others = $(addprefix $(zonedir)/,$(zonenames)) \
+install-others = $(addprefix $(zonedir)/,$(zonenames) \
+ $(zonenames:%=posix/%) \
+ $(zonenames:%=right/%)) \
$(installed-localtime-file) $(installed-posixrules-file)
endif
@@ -81,8 +83,14 @@ $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
echo 'ifdef $*-zones' ;\
echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\
+ echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
+ echo ' $$(tzcompile)' ;\
+ echo '$$(addprefix $$(datadir)/zone%/right/,$$($*-zones)): \' ;\
echo '$< $$(objpfx)zic leapseconds yearistype' ;\
echo ' $$(tzcompile)' ;\
+ echo '$$(addprefix $$(datadir)/zone%/posix/,$$($*-zones)): \' ;\
+ echo '$< $$(objpfx)zic /dev/null yearistype' ;\
+ echo ' $$(tzcompile)' ;\
echo 'endif' ;\
echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
) > $@.new
@@ -98,9 +106,18 @@ echo-zonenames: zonenames
# the command line of `make install' (e.g., "make install prefix=/foo").
zic-cmd = $(built-program-cmd) -d $(zonedir)
define tzcompile
-$(zic-cmd) -L $(word 3,$^) -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
+$(zic-cmd)$(target-zone-flavor)
+ -L $(word 3,$^) -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
endef
+# The source files specify the zone names relative to the -d directory,
+# so for the posix/ and right/ flavors we need to pass -d $(zonedir)/posix
+# and the like. This magic extracts /posix or /right if it's the first
+# component after $(zonedir) in the target name $@.
+target-zone-flavor = $(filter /posix /right, \
+ /$(firstword $(subst /, , \
+ $(patsubst $(zonedir)/%,%,$@))))
+
ifdef localtime
$(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
$(zic-cmd) -l $(localtime)
diff --git a/time/tzset.c b/time/tzset.c
index 2635155dd2..007997f541 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -90,18 +90,23 @@ DEFUN_VOID(__tzset)
tz_rules[1].name != tz_rules[0].name)
free((PTR) tz_rules[1].name);
- tz = getenv("TZ");
+ /* Examine the TZ environment variable. */
+ tz = getenv ("TZ");
- if (tz != NULL && *tz == ':')
+ if (tz != NULL)
{
- __tzfile_read(tz + 1);
+ /* 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. */
+ if (*tz == ':')
+ ++tz;
+
+ __tzfile_read (tz);
if (__use_tzfile)
{
__tzset_run = 1;
return;
}
- else
- tz = NULL;
}
if (tz == NULL || *tz == '\0')