tzdata/000075500000000000000000000000001200432704500123405ustar00rootroot00000000000000tzdata/Makeconfig.in000064400000000000000000000005001200432704500147260ustar00rootroot00000000000000objpfx := @objpfx@ datadir := @datadir@ install_root := @install_root@ AWK := awk built-program-cmd := /usr/sbin/zic cross-compiling := no have-ksh := yes +force = leapseconds = /dev/null posixrules = America/New_York posixrules-file = posixrules zonedir := $(datadir)/zoneinfo inst_zonedir := $(install_root)$(zonedir) tzdata/Makefile000064400000000000000000000011151200432704500137760ustar00rootroot00000000000000all: mkdir obj for i in tzdata*/*; do ln -sf ../$$i src/; done cp -L src/yearistype.sh src/yearistype; chmod +x src/yearistype include ./Makeconfig install: $(MAKE) -C src install check: $(objpfx)test-tz $(objpfx)tst-timezone $(objpfx)test-tz: src/test-tz.c $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< TZDIR=$(inst_zonedir) $@ || ( echo TEST FAILED; exit 1 ) $(objpfx)tst-timezone: src/tst-timezone.c $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< TZDIR=$(inst_zonedir) $@ || ( echo TEST FAILED; exit 1 ) clean: rm -rf obj src/yearistype for i in tzdata*/*; do rm -f src/`basename $$i`; done tzdata/Rules000064400000000000000000000006551200432704500133630ustar00rootroot00000000000000$(objpfx)zic: /dev/null touch $@ $(objpfx)scheck.o: /dev/null touch $@ $(objpfx)ialloc.o: /dev/null touch $@ define make-target-directory $(addprefix mkdir -p ,\ $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%))) endef define do-install $(make-target-directory) /usr/bin/install -m 644 $< $@ endef install: $(inst_zonedir)/ $(MAKE) install-data $(inst_zonedir)/: ; $(make-target-directory) install-data: $(install-others) tzdata/src/000075500000000000000000000000001200432704500131275ustar00rootroot00000000000000tzdata/src/Makefile000064400000000000000000000177461200432704500146060ustar00rootroot00000000000000# Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # The GNU C Library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public # License along with the GNU C Library; if not, write to the Free # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # 02111-1307 USA. # # Makefile for timezone information # subdir := timezone distribute := tzfile.h private.h scheck.c ialloc.c yearistype \ iso3166.tab zone.tab tzselect.ksh checktab.awk \ README extra-objs := scheck.o ialloc.o others := zdump zic tests := test-tz tst-timezone tzbases := africa antarctica asia australasia europe northamerica \ southamerica etcetera factory \ solar87 solar88 solar89 tzlinks := backward systemv tzfiles := $(tzbases) $(tzlinks) # pacificnew doesn't compile; if it is to be used, it should be included in # northamerica. distribute += $(tzfiles) leapseconds pacificnew simplebackw generated := $(addprefix z.,$(tzfiles)) install-sbin := zic zdump generated-dirs = testdata all: # Make this the default target; it will be defined in Rules. include ../Makeconfig # Get objpfx defined so we can use it below. CPPFLAGS-zic = -DNOT_IN_libc # z.* use this variable. define nl endef ifndef avoid-generated ifndef inhibit_timezone_rules -include $(addprefix $(objpfx)z.,$(tzfiles)) endif endif # Make these absolute file names. installed-localtime-file := $(firstword $(filter /%,$(inst_localtime-file)) \ $(addprefix $(inst_zonedir)/, \ $(localtime-file))) installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \ $(addprefix $(inst_zonedir)/, \ $(posixrules-file))) ifeq ($(cross-compiling),no) # Don't try to install the zoneinfo files since we can't run zic. install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \ $(zonenames:%=posix/%) \ $(zonenames:%=right/%)) \ $(installed-localtime-file) $(installed-posixrules-file) endif ifeq ($(have-ksh),yes) install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab install-bin-script = tzselect generated += tzselect endif include ../Rules $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile # Kludge alert: we use an implicit rule (in what we are generating here) # because that is the only way to tell Make that the one command builds all # the files. # The extra kludge for the $(tzlinks) files is necessary since running zic # this file requires all other files to exist. Blech! $(make-target-directory) (echo 'define $*-zones' ;\ $(AWK) '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^ ;\ echo 'endef' ;\ echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\ echo 'ifdef $*-zones' ;\ if test x$(findstring $*, $(tzlinks)) != x; then \ echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)): \';\ echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones)))' ;\ echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)): \';\ echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones)))' ;\ echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \' ;\ echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\ fi ;\ echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;\ echo '$< $$(objpfx)zic leapseconds yearistype' ;\ echo ' $$(tzcompile)' ;\ echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;\ echo '$< $$(objpfx)zic /dev/null yearistype' ;\ echo ' $$(tzcompile)' ;\ echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;\ echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\ echo ' $$(tzcompile)' ;\ echo 'endif' ;\ echo 'zonenames := $$(zonenames) $$($*-zones)' ;\ ) > $@.new mv $@.new $@ .PHONY: echo-zonenames echo-zonenames: @echo 'Known zones: $(zonenames)' # We have to use `-d $(inst_zonedir)' to explictly tell zic where to # place the output files although $(zonedir) is compiled in. But the # user might have set $(install_root) on the command line of `make install'. zic-cmd = $(built-program-cmd) -d $(inst_zonedir) tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \ -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $< # The source files specify the zone names relative to the -d directory, # so for the posix/ and right/ flavors we need to pass -d $(inst_zonedir)/posix # and the like. This magic extracts /posix or /right if it's the first # component after $(inst_zonedir) in the target name $@. target-zone-flavor = $(filter /posix /right, \ /$(firstword $(subst /, , \ $(patsubst $(inst_zonedir)/%,%,$@)))) ifdef localtime $(installed-localtime-file): $(inst_zonedir)/$(localtime) $(objpfx)zic \ $(+force) $(make-target-directory) if test -r $@; then \ echo Site timezone NOT reset to Factory.; \ else \ rm -f $@T; \ $(SHELL) $(..)scripts/rellns-sh $< $@T; \ mv -f $@T $@; \ fi endif ifdef posixrules $(installed-posixrules-file): $(inst_zonedir)/$(posixrules) $(objpfx)zic \ $(+force) $(zic-cmd) -p $(posixrules) endif $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o tz-cflags = -DTZDIR='"$(zonedir)"' \ -DTZDEFAULT='"$(localtime-file)"' \ -DTZDEFRULES='"$(posixrules-file)"' \ -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID $(tz-cflags) -DHAVE_GETTEXT CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags) -DHAVE_GETTEXT CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID -DHAVE_GETTEXT CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID -DHAVE_GETTEXT # We have to make sure the data for testing the tz functions is available. # Don't add leapseconds here since test-tz made checks that work only without # leapseconds. testdata = $(objpfx)testdata define build-testdata GCONV_PATH=${common-objpfx}iconvdata LANGUAGE=C LC_ALL=C \ $(built-program-cmd) -d $(testdata) -y ./yearistype $< endef $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC) $(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \ Europe/Berlin Universal \ Australia/Melbourne \ America/Sao_Paulo Asia/Tokyo \ Europe/London) test-tz-ENV = TZDIR=$(testdata) tst-timezone-ENV = TZDIR=$(testdata) $(testdata)/America/New_York: northamerica $(objpfx)zic $(leapseconds) \ yearistype $(build-testdata) $(testdata)/Etc/UTC: etcetera $(objpfx)zic $(leapseconds) yearistype $(build-testdata) $(testdata)/UTC: simplebackw $(objpfx)zic $(testdata)/Etc/UTC \ $(leapseconds) yearistype $(build-testdata) $(testdata)/Europe/Berlin: europe $(objpfx)zic $(leapseconds) yearistype $(build-testdata) $(testdata)/Universal: simplebackw $(objpfx)zic $(testdata)/Etc/UTC \ $(leapseconds) yearistype $(build-testdata) $(testdata)/Australia/Melbourne: australasia $(objpfx)zic $(leapseconds) \ yearistype $(build-testdata) $(testdata)/America/Sao_Paulo: southamerica $(objpfx)zic $(leapseconds) \ yearistype $(build-testdata) $(testdata)/Asia/Tokyo: asia $(objpfx)zic $(leapseconds) yearistype $(build-testdata) $(testdata)/Europe/London: europe $(objpfx)zic $(leapseconds) yearistype $(build-testdata) $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make sed -e 's%@KSH@%$(KSH)%g' \ -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new chmod 555 $@.new mv -f $@.new $@ $(addprefix $(inst_zonedir)/,iso3166.tab zone.tab): \ $(inst_zonedir)/%: % $(+force) $(do-install) tzdata/src/simplebackw000064400000000000000000000000611200432704500153500ustar00rootroot00000000000000Link Etc/UTC UTC Link Etc/Universal Universal tzdata/src/test-tz.c000064400000000000000000000017741200432704500147160ustar00rootroot00000000000000#include #include #include #include struct { const char * env; time_t expected; } tests[] = { {"MST", 832935315}, {"", 832910115}, {":UTC", 832910115}, {"UTC", 832910115}, {"UTC0", 832910115} }; int main (int argc, char ** argv) { int errors = 0; struct tm tm; time_t t; unsigned int i; memset (&tm, 0, sizeof (tm)); tm.tm_isdst = 0; tm.tm_year = 96; /* years since 1900 */ tm.tm_mon = 4; tm.tm_mday = 24; tm.tm_hour = 3; tm.tm_min = 55; tm.tm_sec = 15; for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) { setenv ("TZ", tests[i].env, 1); t = mktime (&tm); if (t != tests[i].expected) { printf ("%s: flunked test %u (expected %lu, got %lu)\n", argv[0], i, (long) tests[i].expected, (long) t); ++errors; } } if (errors == 0) { puts ("No errors."); return EXIT_SUCCESS; } else { printf ("%d errors.\n", errors); return EXIT_FAILURE; } } tzdata/src/tst-timezone.c000064400000000000000000000114471200432704500157440ustar00rootroot00000000000000/* Copyright (C) 1998, 1999, 2000, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 1998. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include #include #include #include #include int failed = 0; struct test_times { const char *name; int daylight; int timezone; const char *tzname[2]; }; static const struct test_times tests[] = { { "Europe/Amsterdam", 1, -3600, { "CET", "CEST" }}, { "Europe/Berlin", 1, -3600, { "CET", "CEST" }}, { "Europe/London", 1, 0, { "GMT", "BST" }}, { "Universal", 0, 0, {"UTC", "UTC" }}, { "Australia/Melbourne", 1, -36000, { "EST", "EST" }}, { "America/Sao_Paulo", 1, 10800, {"BRT", "BRST" }}, { "America/Chicago", 1, 21600, {"CST", "CDT" }}, { "America/Indiana/Indianapolis", 1, 18000, {"EST", "EDT" }}, { "America/Los_Angeles", 1, 28800, {"PST", "PDT" }}, { "Pacific/Auckland", 1, -43200, { "NZST", "NZDT" }}, { NULL, 0, 0 } }; /* This string will be used for `putenv' calls. */ char envstring[100]; static void print_tzvars (void) { printf ("tzname[0]: %s\n", tzname[0]); printf ("tzname[1]: %s\n", tzname[1]); printf ("daylight: %d\n", daylight); printf ("timezone: %ld\n", timezone); } static void check_tzvars (const char *name, int dayl, int timez, const char *const tznam[]) { int i; if (daylight != dayl) { printf ("*** Timezone: %s, daylight is: %d but should be: %d\n", name, daylight, dayl); ++failed; } if (timezone != timez) { printf ("*** Timezone: %s, timezone is: %ld but should be: %d\n", name, timezone, timez); ++failed; } for (i = 0; i <= 1; ++i) if (strcmp (tzname[i], tznam[i]) != 0) { printf ("*** Timezone: %s, tzname[%d] is: %s but should be: %s\n", name, i, tzname[i], tznam[i]); ++failed; } } int main (int argc, char ** argv) { time_t t; const struct test_times *pt; char buf[BUFSIZ]; /* This should be: Fri May 15 01:02:16 1998 (UTC). */ t = 895194136; printf ("We use this date: %s\n", asctime (gmtime (&t))); for (pt = tests; pt->name != NULL; ++pt) { /* Start with a known state */ printf ("Checking timezone %s\n", pt->name); sprintf (buf, "TZ=%s", pt->name); if (putenv (buf)) { puts ("putenv failed."); failed = 1; } tzset (); print_tzvars (); check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname); /* calling localtime shouldn't make a difference */ localtime (&t); print_tzvars (); check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname); } /* From a post of Scott Harrington to the timezone mailing list. */ { struct tm tmBuf = {0, 0, 0, 10, 3, 98, 0, 0, -1}; char buf[200]; strcpy (envstring, "TZ=Europe/London"); putenv (envstring); t = mktime (&tmBuf); snprintf (buf, sizeof (buf), "TZ=%s %ld %d %d %d %d %d %d %d %d %d", getenv ("TZ"), t, tmBuf.tm_sec, tmBuf.tm_min, tmBuf.tm_hour, tmBuf.tm_mday, tmBuf.tm_mon, tmBuf.tm_year, tmBuf.tm_wday, tmBuf.tm_yday, tmBuf.tm_isdst); fputs (buf, stdout); puts (" should be"); puts ("TZ=Europe/London 892162800 0 0 0 10 3 98 5 99 1"); if (strcmp (buf, "TZ=Europe/London 892162800 0 0 0 10 3 98 5 99 1") != 0) { failed = 1; fputs (" FAILED ***", stdout); } } printf("\n"); { struct tm tmBuf = {0, 0, 0, 10, 3, 98, 0, 0, -1}; char buf[200]; strcpy (envstring, "TZ=GMT"); /* No putenv call needed! */ t = mktime (&tmBuf); snprintf (buf, sizeof (buf), "TZ=%s %ld %d %d %d %d %d %d %d %d %d", getenv ("TZ"), t, tmBuf.tm_sec, tmBuf.tm_min, tmBuf.tm_hour, tmBuf.tm_mday, tmBuf.tm_mon, tmBuf.tm_year, tmBuf.tm_wday, tmBuf.tm_yday, tmBuf.tm_isdst); fputs (buf, stdout); puts (" should be"); puts ("TZ=GMT 892166400 0 0 0 10 3 98 5 99 0"); if (strcmp (buf, "TZ=GMT 892166400 0 0 0 10 3 98 5 99 0") != 0) { failed = 1; fputs (" FAILED ***", stdout); } } return failed ? EXIT_FAILURE : EXIT_SUCCESS; }