+++ /dev/null
-objpfx := @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)
+++ /dev/null
-all:
- 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
+++ /dev/null
-$(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)
--- /dev/null
+diff -ru tzdata2014j.org/iso3166.tab tzdata2014j/iso3166.tab
+--- tzdata2014j.org/iso3166.tab 2014-07-19 05:31:54.000000000 +0900
++++ tzdata2014j/iso3166.tab 2015-01-16 17:25:47.240804590 +0900
+@@ -100,7 +100,7 @@
+ FO Faroe Islands
+ FR France
+ GA Gabon
+-GB Britain (UK)
++GB United Kingdom
+ GD Grenada
+ GE Georgia
+ GF French Guiana
--- /dev/null
+diff -ru tzdata2014j.org/asia tzdata2014j/asia
+--- tzdata2014j.org/asia 2014-11-01 11:51:05.000000000 +0900
++++ tzdata2014j/asia 2015-01-16 16:29:55.152804990 +0900
+@@ -524,6 +524,8 @@
+ Zone Asia/Urumqi 5:50:20 - LMT 1928
+ 6:00 - XJT
+
++# Nowadays, China Standard Time is known as "Beijing Time"
++Zone Asia/Beijing 8:00 PRC C%sT
+
+ # Hong Kong (Xianggang)
+
+diff -ru tzdata2014j.org/backward tzdata2014j/backward
+--- tzdata2014j.org/backward 2014-08-17 14:48:03.000000000 +0900
++++ tzdata2014j/backward 2015-01-16 16:31:50.884804977 +0900
+@@ -92,14 +92,13 @@
+ Link Pacific/Auckland NZ
+ Link Pacific/Chatham NZ-CHAT
+ Link America/Denver Navajo
+-Link Asia/Shanghai PRC
++Link Asia/Beijing PRC
+ Link Pacific/Pohnpei Pacific/Ponape
+ Link Pacific/Pago_Pago Pacific/Samoa
+ Link Pacific/Chuuk Pacific/Truk
+ Link Pacific/Chuuk Pacific/Yap
+ Link Europe/Warsaw Poland
+ Link Europe/Lisbon Portugal
+-Link Asia/Taipei ROC
+ Link Asia/Seoul ROK
+ Link Asia/Singapore Singapore
+ Link Europe/Istanbul Turkey
+diff -ru tzdata2014j.org/zone.tab tzdata2014j/zone.tab
+--- tzdata2014j.org/zone.tab 2014-10-14 12:43:59.000000000 +0900
++++ tzdata2014j/zone.tab 2015-01-16 17:18:24.048804643 +0900
+@@ -143,8 +143,12 @@
+ CL -3327-07040 America/Santiago most locations
+ CL -2709-10926 Pacific/Easter Easter Island
+ CM +0403+00942 Africa/Douala
+-CN +3114+12128 Asia/Shanghai Beijing Time
+-CN +4348+08735 Asia/Urumqi Xinjiang Time
++CN +3955+11626 Asia/Beijing China Standard Time
++CN +3114+12128 Asia/Shanghai China east
++CN +4545+12641 Asia/Harbin China north
++CN +2934+10635 Asia/Chongqing China mountains
++CN +4348+08735 Asia/Urumqi China Xinjiang-Tibet
++CN +3929+07559 Asia/Kashgar China west Xinjiang
+ CO +0436-07405 America/Bogota
+ CR +0956-08405 America/Costa_Rica
+ CU +2308-08222 America/Havana
+++ /dev/null
-* Fri May 27 2011 Anas Nashif <anas.nashif@intel.com> - 2010b
-- Dont depend on fdupes, avoid too many cycles
-
-* Tue May 24 2011 Anas Nashif <anas.nashif@intel.com> - 2010b
-- Repackage documentaion/translations
-
-* Sat Apr 10 2010 Anas Nashif <anas.nashif@intel.com> - 2010b
-- Fixed rpmlint errors
-
-* Mon Feb 08 2010 Austin Zhang <austin.zhang@intel.com> - 2010b
-- Upstream 2010b
-
-Summary: Timezone data
-Name: tzdata
-Version: 2011h
-%define tzdata_version %{version}
-%define tzcode_version 2011g
-Release: 1
-License: Public Domain
-Group: System/Base
-URL: ftp://elsie.nci.nih.gov/pub/
-
-# The tzdata-base-0.tar.bz2 is a simple building infrastructure and
-# test suite. It is occasionally updated from glibc sources, and as
-# such is under LGPLv2+, but none of this ever gets to be part of
-# final zoneinfo files.
-Source0: %{name}-%{version}.tar.bz2
+Summary: Timezone data
+Name: tzdata
+Version: 2014j
+Release: 1
+License: PD
+Group: System/Base
+URL: http://www.iana.org/time-zones
+
+Source0: %{name}-%{version}.tar.gz
# These are official upstream.
-Source1: ftp://elsie.nci.nih.gov/pub/tzdata%{tzdata_version}.tar.gz
-Source2: ftp://elsie.nci.nih.gov/pub/tzcode%{tzcode_version}.tar.gz
+Source1: ftp://ftp.iana.org/tz/releases/tzdata%{version}.tar.gz
+Source2: ftp://ftp.iana.org/tz/releases/tzcode%{version}.tar.gz
+Patch1: tzdata-china-2014.patch
+Patch2: iso3166-uk-2014.patch
BuildArch: noarch
+%global AREA Etc
+%global ZONE UTC
%description
This package contains data files with rules for various timezones around
the world.
%prep
-%setup -q -n %{name}-%{version}
-mkdir tzdata%{tzdata_version}
-tar xzf %{SOURCE1} -C tzdata%{tzdata_version}
-mkdir tzcode%{tzcode_version}
-tar xzf %{SOURCE2} -C tzcode%{tzcode_version}
-sed -e 's|@objpfx@|'`pwd`'/obj/|' \
- -e 's|@datadir@|%{_datadir}|' \
- Makeconfig.in > Makeconfig
+%setup -c -T -b 1 -b 2
+%patch1 -p1
+%patch2 -p1
+sed -ri 's@/usr/local/etc/zoneinfo@%{_datadir}/zoneinfo@g' *
%build
-make
+unset ${!LC_*}
+LANG=POSIX
+LC_ALL=POSIX
+AREA=%{AREA}
+ZONE=%{ZONE}
+export AREA LANG LC_ALL ZONE
+make %{?_smp_mflags} TZDIR=%{_datadir}/zoneinfo CFLAGS="$RPM_OPT_FLAGS -DHAVE_GETTEXT=1 -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone" AWK=awk
+make %{?_smp_mflags} TZDIR=zoneinfo AWK=awk zones
+# Generate posixrules
+./zic -y ./yearistype -d zoneinfo -p %{AREA}/%{ZONE}
%install
-rm -fr $RPM_BUILD_ROOT
-sed -i 's|@install_root@|%{buildroot}|' Makeconfig
-make install
+rm -fr %{buildroot}
+mkdir -p %{buildroot}%{_datadir}/zoneinfo
+cp -a zoneinfo %{buildroot}%{_datadir}/zoneinfo/posix
+cp -al %{buildroot}%{_datadir}/zoneinfo/posix/. %{buildroot}%{_datadir}/zoneinfo
+cp -a zoneinfo-leaps %{buildroot}%{_datadir}/zoneinfo/right
+rm -f %{buildroot}%{_datadir}/zoneinfo/posixrules
+ln -sf /etc/localtime %{buildroot}%{_datadir}/zoneinfo/posixrules
+install -m 644 iso3166.tab %{buildroot}%{_datadir}/zoneinfo/iso3166.tab
+install -m 644 zone.tab %{buildroot}%{_datadir}/zoneinfo/zone.tab
+#mkdir -p %{buildroot}/etc
+#rm -f %{buildroot}/etc/localtime
+#cp -fp %{buildroot}%{_datadir}/zoneinfo/%{AREA}/%{ZONE} %{buildroot}/etc/localtime
%check
-echo ====================TESTING=========================
-make check
-echo ====================TESTING END=====================
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_datadir}/zoneinfo
-
+++ /dev/null
-# 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)
+++ /dev/null
-Link Etc/UTC UTC
-Link Etc/Universal Universal
+++ /dev/null
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-#include <stdio.h>
-
-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;
- }
-}
+++ /dev/null
-/* Copyright (C) 1998, 1999, 2000, 2005, 2007 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Andreas Jaeger <aj@suse.de>, 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 <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-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 <seh4@ix.netcom.com> 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;
-}