aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
committerRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
commit28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch)
tree15f07c4c43d635959c6afee96bde71fb1b3614ee /time
downloadglibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.xz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip
initial import
Diffstat (limited to 'time')
-rw-r--r--time/.cvsignore4
-rw-r--r--time/Makefile126
-rw-r--r--time/africa603
-rw-r--r--time/antarctica19
-rw-r--r--time/ap.c46
-rw-r--r--time/asctime.c50
-rw-r--r--time/asia803
-rw-r--r--time/australasia783
-rw-r--r--time/backward75
-rw-r--r--time/clocktest.c16
-rw-r--r--time/ctime.c35
-rw-r--r--time/date.c49
-rw-r--r--time/difftime.c66
-rw-r--r--time/dysize.c26
-rw-r--r--time/emkdir.c85
-rw-r--r--time/etcetera54
-rw-r--r--time/europe2072
-rw-r--r--time/factory8
-rw-r--r--time/gmtime.c33
-rw-r--r--time/ialloc.c103
-rw-r--r--time/leapseconds41
-rw-r--r--time/localtime.c84
-rw-r--r--time/mktime.c506
-rw-r--r--time/northamerica953
-rw-r--r--time/offtime.c84
-rw-r--r--time/pacificnew26
-rw-r--r--time/private.h210
-rw-r--r--time/scheck.c62
-rw-r--r--time/solar87386
-rw-r--r--time/solar88386
-rw-r--r--time/solar89391
-rw-r--r--time/southamerica397
-rw-r--r--time/strftime.c296
-rw-r--r--time/sys/time.h147
-rw-r--r--time/sys/timeb.h43
-rw-r--r--time/systemv35
-rw-r--r--time/test_time.args2
-rw-r--r--time/test_time.c117
-rw-r--r--time/time.h204
-rw-r--r--time/timegm.c27
-rw-r--r--time/tzfile.c332
-rw-r--r--time/tzfile.h170
-rw-r--r--time/tzset.c487
-rwxr-xr-xtime/yearistype26
-rw-r--r--time/zdump.c331
-rw-r--r--time/zic.c1956
46 files changed, 12755 insertions, 0 deletions
diff --git a/time/.cvsignore b/time/.cvsignore
new file mode 100644
index 0000000000..1f69fd919a
--- /dev/null
+++ b/time/.cvsignore
@@ -0,0 +1,4 @@
+*.gz *.Z *.tar *.tgz
+=*
+TODO COPYING* AUTHORS copyr-* copying.*
+glibc-*
diff --git a/time/Makefile b/time/Makefile
new file mode 100644
index 0000000000..684fa51a53
--- /dev/null
+++ b/time/Makefile
@@ -0,0 +1,126 @@
+# Copyright (C) 1991, 1992, 1993, 1994, 1995 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 Library General Public License as
+# published by the Free Software Foundation; either version 2 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
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB. If
+# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+# Cambridge, MA 02139, USA.
+
+#
+# Makefile for time routines
+#
+subdir := time
+
+headers := time.h sys/time.h sys/timeb.h
+distribute := tzfile.h private.h scheck.c ialloc.c emkdir.c yearistype
+extra-objs = scheck.o ialloc.o emkdir.o zonenames $(tzfiles:%=z.%)
+
+routines := offtime asctime clock ctime difftime gmtime \
+ localtime mktime strftime time tzset tzfile \
+ gettimeofday settimeofday adjtime \
+ getitimer setitimer \
+ stime dysize timegm ftime
+
+others := ap zdump zic
+tests := test_time clocktest
+
+tzfiles := africa antarctica asia australasia europe northamerica \
+ southamerica etcetera factory systemv backward
+# pacificnew doesn't compile; if it is to be used, it should be included in
+# northamerica.
+distribute := $(distribute) $(tzfiles) leapseconds pacificnew
+
+install-sbin := zic zdump
+
+include ../Makeconfig # Get objpfx defined so we can use it below.
+
+# zonenames uses this variable.
+define nl
+
+
+endef
+include $(objpfx)zonenames
+
+# Make these absolute file names.
+installed-localtime-file := $(firstword $(filter /%,$(localtime-file)) \
+ $(addprefix $(zonedir)/, \
+ $(localtime-file)))
+installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
+ $(addprefix $(zonedir)/, \
+ $(posixrules-file)))
+
+ifndef cross-compiling
+# Don't try to install the zoneinfo files since we can't run zic.
+install-others = $(addprefix $(zonedir)/,$(zonenames)) \
+ $(installed-localtime-file) $(installed-posixrules-file)
+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.
+ (echo 'define $*-zones' ;\
+ awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^;\
+ echo 'endef' ;\
+ echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
+ echo 'ifdef $*-zones' ;\
+ echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\
+ echo '$< $$(objpfx)zic leapseconds yearistype' ;\
+ echo ' $$(tzcompile)' ;\
+ echo 'endif' ;\
+ echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
+ ) > $@.new
+ mv $@.new $@
+$(objpfx)zonenames: Makefile
+ (for file in $(tzfiles); do \
+ echo "include \$$(objpfx)z.$$file"; \
+ done) > $@.new
+ mv $@.new $@
+
+.PHONY: echo-zonenames
+echo-zonenames: zonenames
+ @echo 'Known zones: $(zonenames)'
+
+
+# Although $(zonedir) gets compiled into zic, it is useful to always
+# specify it with -d on the command line so that it can be overridden on
+# the command line of `make install' (e.g., "make install prefix=/foo").
+zic-cmd = $(dir $(word 2,$^))$(notdir $(word 2,$^)) -d $(zonedir)
+define tzcompile
+$(zic-cmd) -L $(word 3,$^) -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
+endef
+
+ifdef localtime
+$(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
+ $(zic-cmd) -l $(localtime)
+endif
+ifdef posixrules
+$(installed-posixrules-file): $(zonedir)/$(posixrules) $(objpfx)zic
+ $(zic-cmd) -p $(posixrules)
+endif
+
+
+$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o $(objpfx)emkdir.o
+
+$(objpfx)tzfile.o: tzfile.c; $(tz-cc)
+$(objpfx)zic.o: zic.c; $(tz-cc)
+
+# Some versions of GNU make have a bug with backslashes in define directives.
+tz-cc = $(COMPILE.c) $(+gcc-nowarn) \
+ -DTZDIR='"$(zonedir)"' \
+ -DTZDEFAULT='"$(localtime-file)"' \
+ -DTZDEFRULES='"$(posixrules-file)"' \
+ $< $(OUTPUT_OPTION)
diff --git a/time/africa b/time/africa
new file mode 100644
index 0000000000..a9786670b5
--- /dev/null
+++ b/time/africa
@@ -0,0 +1,603 @@
+# @(#)africa 7.6
+
+# This data is by no means authoritative; if you think you know better,
+# go ahead and edit the file (and please send any changes to
+# tz@elsie.nci.nih.gov for general use in the future).
+
+# From Paul Eggert <eggert@twinsun.com> (November 18, 1993):
+#
+# A good source for time zone historical data outside the U.S. is
+# Thomas G. Shanks, The International Atlas (3rd edition),
+# San Diego: ACS Publications, Inc. (1991).
+# Except where otherwise noted, it is the source for the data below.
+#
+# Another source occasionally used is Edward W. Whitman, World Time Differences,
+# Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
+# I found in the UCLA library.
+#
+# I added so many Zone names that the old, mostly flat name space was unwieldy.
+# So I renamed the Zones to have the form AREA/LOCATION, where
+# AREA is the name of a continent or ocean, and
+# LOCATION is the name of a specific location within that region.
+# For example, the old zone name `Egypt' is now `Africa/Cairo'.
+#
+# Here are the general rules I used for choosing location names,
+# in decreasing order of importance:
+#
+# Use only valid Posix file names. Use only Ascii letters, digits, `.',
+# `-' and `_'. Do not exceed 14 characters or start with `-'.
+# E.g. prefer `Brunei' to `Bandar_Seri_Begawan'.
+# Include at least one location per time zone rule set per country.
+# One such location is enough.
+# If a name is ambiguous, use a less ambiguous alternative;
+# e.g. many cities are named San Jose and Georgetown, so
+# prefer `Costa_Rica' to `San_Jose' and `Guyana' to `Georgetown'.
+# Keep locations compact. Use cities or small islands, not countries
+# or regions, so that any future time zone changes do not split
+# locations into different time zones. E.g. prefer `Paris'
+# to `France', since France has had multiple time zones.
+# Use traditional English spelling, e.g. prefer `Rome' to `Roma', and
+# prefer `Athens' to the true name (which uses Greek letters).
+# The Posix file name restrictions encourage this rule.
+# Use the most populous among locations in a country's time zone,
+# e.g. prefer `Shanghai' to `Beijing'. Among locations with
+# similar populations, pick the best-known location,
+# e.g. prefer `Rome' to `Milan'.
+# Use the singular form, e.g. prefer `Canary' to `Canaries'.
+# Omit common suffixes like `_Islands' and `_City', unless that
+# would lead to ambiguity. E.g. prefer `Cayman' to
+# `Cayman_Islands' and `Guatemala' to `Guatemala_City',
+# but prefer `Mexico_City' to `Mexico' because the country
+# of Mexico has several time zones.
+# Use `_' to represent a space.
+# Omit `.' from abbreviations in names, e.g. prefer `St_Helena'
+# to `St._Helena'.
+#
+# We typically use traditional English time zone abbreviations,
+# and assume that applications translate them to other languages
+# as part of the normal localization process.
+#
+# I made up the following time zone abbreviations; corrections are welcome!
+# LMT Local Mean Time
+# -2:00 CVT Cape Verde Time (no longer used)
+# -1:00 AAT Atlantic Africa Time
+# 0:00 WAT West Africa Time
+# 1:00 CAT Central Africa Time
+# 2:00 SAT South Africa Time
+# 3:00 EAT East Africa Time
+# 4:00 SMT Seychelles and Mascarene Time
+# The final `T' is replaced by `ST' for summer time, e.g. `SAST'.
+# BEAT is British East Africa Time, which was 2:30 before 1948 and 2:45 after.
+
+
+# Algeria
+# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+Rule Algeria 1911 only - Jan 1 0:00s 0 -
+Rule Algeria 1916 only - Jun 14 23:00s 1:00 " DST"
+Rule Algeria 1916 1919 - Oct Sun<=7 23:00s 0 -
+Rule Algeria 1917 only - Mar 24 23:00s 1:00 " DST"
+Rule Algeria 1918 only - Mar 9 23:00s 1:00 " DST"
+Rule Algeria 1919 only - Mar 1 23:00s 1:00 " DST"
+Rule Algeria 1920 only - Feb 14 23:00s 1:00 " DST"
+Rule Algeria 1920 only - Oct 23 23:00s 0 -
+Rule Algeria 1921 only - Mar 14 23:00s 1:00 " DST"
+Rule Algeria 1921 only - Jun 21 23:00s 0 -
+Rule Algeria 1939 only - Sep 11 23:00s 1:00 " DST"
+Rule Algeria 1939 only - Nov 19 1:00 0 -
+Rule Algeria 1944 1945 - Apr Mon<=7 2:00 1:00 " DST"
+Rule Algeria 1944 only - Oct 8 2:00 0 -
+Rule Algeria 1945 only - Sep 16 1:00 0 -
+Rule Algeria 1971 only - Apr 25 23:00s 1:00 " DST"
+Rule Algeria 1971 only - Sep 26 23:00s 0 -
+Rule Algeria 1977 only - May 6 0:00 1:00 " DST"
+Rule Algeria 1977 only - Oct 21 0:00 0 -
+Rule Algeria 1978 only - Mar 24 1:00 1:00 " DST"
+Rule Algeria 1978 only - Sep 22 3:00 0 -
+Rule Algeria 1980 only - Apr 25 0:00 1:00 " DST"
+Rule Algeria 1980 only - Oct 31 2:00 0 -
+# Shanks gives 0:09 for Paris Mean Time; go with Whitman's more precise 0:09:05.
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 15 0:01
+ 0:09:05 - PMT 1911 Mar 11 # Paris Mean Time
+ 0:00 Algeria WET%s 1940 Feb 25 2:00
+ 1:00 Algeria MET%s 1946 Oct 7
+ 0:00 - WET 1956 Jan 29
+ 1:00 - MET 1963 Apr 14
+ 0:00 Algeria WET%s 1977 Oct 21
+ 1:00 Algeria MET%s 1979 Oct 26
+ 0:00 Algeria WET%s 1981 May
+ 1:00 - MET
+
+# Angola
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Luanda 0:52:56 - LMT 1892
+ 0:52 - LMT 1911 May 26 # Luanda Mean Time
+ 1:00 - CAT
+
+# Benin
+# Whitman says they switched to 1:00 in 1946, not 1934; go with Shanks.
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Porto-Novo 0:10:28 - LMT 1912
+ 0:00 - WAT 1934 Feb 26
+ 1:00 - CAT
+
+# Botswana
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Gaborone 1:43:40 - LMT 1885
+ 2:00 - SAT 1943 Sep 19 2:00
+ 2:00 1:00 SAST 1944 Mar 19 2:00
+ 2:00 - SAT
+
+# Burkina Faso
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Ouagadougou -0:06:04 - LMT 1912
+ 0:00 - WAT
+
+# Burundi
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Bujumbura 1:57:28 - LMT 1890
+ 2:00 - SAT
+
+# Cameroon
+# Whitman says they switched to 1:00 in 1920; go with Shanks.
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Douala 0:38:48 - LMT 1912
+ 1:00 - CAT
+
+# Cape Verde
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Atlantic/Cape_Verde -1:34:04 - LMT 1907 # Praia
+ -2:00 - CVT 1942 Sep
+ -2:00 1:00 CVST 1945 Oct 15
+ -2:00 - CVT 1975 Nov 25 2:00
+ -1:00 - AAT
+
+# Central African Republic
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Bangui 1:14:20 - LMT 1912
+ 1:00 - CAT
+
+# Chad
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Ndjamena 1:00:12 - LMT 1912
+ 1:00 - CAT 1979 Oct 14
+ 1:00 1:00 CAST 1980 Mar 8
+ 1:00 - CAT
+
+# Comoros
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Indian/Comoro 2:53:04 - LMT 1911 Jul # Moroni, Gran Comoro
+ 3:00 - EAT
+
+# Congo
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Brazzaville 1:01:08 - LMT 1912
+ 1:00 - CAT
+
+# Cote D'Ivoire
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Abidjan -0:16:08 - LMT 1912
+ 0:00 - WAT
+
+# Djibouti
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Djibouti 2:52:36 - LMT 1911 Jul
+ 3:00 - EAT
+
+###############################################################################
+
+# Egypt
+
+# From Bob Devine (January 28, 1988):
+# Egypt: DST from first day of May to first of October (ending may
+# also be on Sept 30th not 31st -- you might want to ask one of the
+# soc.* groups, you might hit someone who could ask an embassy).
+# DST since 1960 except for 1981-82.
+
+# From U. S. Naval Observatory (January 19, 1989):
+# EGYPT 2 H AHEAD OF UTC
+# EGYPT 3 H AHEAD OF UTC MAY 17 - SEP 30 (AFTER
+# EGYPT RAMADAN)
+
+# From Shanks (1991):
+# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+Rule Egypt 1900 only - Oct 1 0:00 0 -
+Rule Egypt 1940 only - Jul 15 0:00 1:00 " DST"
+Rule Egypt 1940 only - Oct 1 0:00 0 -
+Rule Egypt 1941 only - Apr 15 0:00 1:00 " DST"
+Rule Egypt 1941 only - Sep 16 0:00 0 -
+Rule Egypt 1942 1944 - Apr 1 0:00 1:00 " DST"
+Rule Egypt 1942 only - Oct 27 0:00 0 -
+Rule Egypt 1943 1945 - Nov 1 0:00 0 -
+Rule Egypt 1945 only - Apr 16 0:00 1:00 " DST"
+Rule Egypt 1957 only - May 10 0:00 1:00 " DST"
+Rule Egypt 1957 1958 - Oct 1 0:00 0 -
+Rule Egypt 1958 only - May 1 0:00 1:00 " DST"
+Rule Egypt 1959 1981 - May 1 1:00 1:00 " DST"
+Rule Egypt 1959 1965 - Sep 30 3:00 0 -
+Rule Egypt 1966 max - Oct 1 3:00 0 -
+Rule Egypt 1982 only - Jul 25 1:00 1:00 " DST"
+Rule Egypt 1983 only - Jul 12 1:00 1:00 " DST"
+Rule Egypt 1984 1988 - May 1 1:00 1:00 " DST"
+Rule Egypt 1989 only - May 6 1:00 1:00 " DST"
+Rule Egypt 1990 max - May 1 1:00 1:00 " DST"
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
+ 2:00 Egypt EET%s
+
+# Equatorial Guinea
+# Zone NAME GMTOFF RULES FORMAT [UNTIL]
<