2005-01-25  Jakub Jelinek  <jakub@redhat.com>

	* stdlib/fmtmsg.c (addseverity): Remove new_string variable.
	(free_mem): Don't free string.
	* stdlib/tst-fmtmsg.c: Include string.h.
	(main): Add some more tests.

2005-01-25  Andreas Schwab  <schwab@suse.de>

	* timezone/asia: Update from tzdata2005c.
	* timezone/backward: Likewise.
	* timezone/leapseconds: Likewise.
	* timezone/northamerica: Likewise.
	* timezone/southamerica: Likewise.

	* timezone/private.h: Update from tzcode2005c.
	* timezone/tzfile.h: Likewise.
	* timezone/zdump.c: Likewise.
	* timezone/zic.c: Likewise.
This commit is contained in:
Ulrich Drepper 2005-01-26 00:01:20 +00:00
parent 1f25bddd62
commit 792dcd77cd
13 changed files with 584 additions and 215 deletions

View File

@ -1,3 +1,23 @@
2005-01-25 Jakub Jelinek <jakub@redhat.com>
* stdlib/fmtmsg.c (addseverity): Remove new_string variable.
(free_mem): Don't free string.
* stdlib/tst-fmtmsg.c: Include string.h.
(main): Add some more tests.
2005-01-25 Andreas Schwab <schwab@suse.de>
* timezone/asia: Update from tzdata2005c.
* timezone/backward: Likewise.
* timezone/leapseconds: Likewise.
* timezone/northamerica: Likewise.
* timezone/southamerica: Likewise.
* timezone/private.h: Update from tzcode2005c.
* timezone/tzfile.h: Likewise.
* timezone/zdump.c: Likewise.
* timezone/zic.c: Likewise.
2005-01-25 Ulrich Drepper <drepper@redhat.com>
* sysdeps/i386/dl-machine.h (elf_machine_rel): Remove code using

View File

@ -316,7 +316,7 @@ internal_addseverity (int severity, const char *string)
int result = MM_OK;
/* First see if there is already a record for the severity level. */
for (runp = severity_list, lastp = NULL; runp != NULL; runp = runp-> next)
for (runp = severity_list, lastp = NULL; runp != NULL; runp = runp->next)
if (runp->severity == severity)
break;
else
@ -364,34 +364,17 @@ int
addseverity (int severity, const char *string)
{
int result;
const char *new_string;
/* Prevent illegal SEVERITY values. */
if (severity <= MM_INFO)
return MM_NOTOK;
if (string == NULL)
/* We want to remove the severity class. */
new_string = NULL;
else
{
new_string = __strdup (string);
if (new_string == NULL)
/* Allocation failed or illegal value. */
return MM_NOTOK;
}
/* Protect the global data. */
__libc_lock_lock (lock);
/* Do the real work. */
result = internal_addseverity (severity, string);
if (result != MM_OK)
/* Free the allocated string. */
free ((char *) new_string);
/* Release the lock. */
__libc_lock_unlock (lock);
@ -408,7 +391,6 @@ libc_freeres_fn (free_mem)
{
/* This is data we have to release. */
struct severity_info *here = runp;
free ((char *) runp->string);
runp = runp->next;
free (here);
}

View File

@ -1,6 +1,7 @@
#include <fmtmsg.h>
#include <mcheck.h>
#include <stdio.h>
#include <string.h>
#define MM_TEST 10
@ -12,11 +13,13 @@ main (void)
mtrace ();
if (addseverity (MM_TEST, "TEST") != MM_OK)
char TEST[] = "ABCD";
if (addseverity (MM_TEST, TEST) != MM_OK)
{
puts ("addseverity failed");
result = 1;
}
strcpy (TEST, "TEST");
if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_HALT, "halt",
"should print message for MM_HALT", "GLIBC:tst-fmtmsg:1")
@ -54,5 +57,25 @@ main (void)
result = 1;
}
if (addseverity (MM_TEST, NULL) != MM_NOTOK)
{
puts ("third addseverity unexpectedly succeeded");
result = 1;
}
char *p = strdup ("TEST2");
if (addseverity (MM_TEST, p) != MM_OK)
{
puts ("fourth addseverity failed");
result = 1;
}
if (addseverity (MM_TEST, "TEST3") != MM_OK)
{
puts ("fifth addseverity failed");
result = 1;
}
free (p);
return result;
}

View File

@ -1,4 +1,4 @@
# @(#)asia 7.77
# @(#)asia 7.78
# 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
@ -639,7 +639,7 @@ Rule Zion 1988 only - Apr 9 0:00 1:00 D
Rule Zion 1988 only - Sep 3 0:00 0 S
# From Ephraim Silverberg <ephraim@cs.huji.ac.il>
# (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17 and 2000-07-25):
# (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, and 2004-12-22):
# According to the Office of the Secretary General of the Ministry of
# Interior, there is NO set rule for Daylight-Savings/Standard time changes.
@ -690,13 +690,13 @@ Rule Zion 1995 only - Sep 3 0:00 0 S
# time, Haim Ramon. The official announcement regarding 1996-1998
# (with the dates for 1997-1998 no longer being relevant) can be viewed at:
#
# ftp://ftp.huji.ac.il/pub/tz/announcements/1996-1998.ramon.ps.gz
# ftp://ftp.cs.huji.ac.il/pub/tz/announcements/1996-1998.ramon.ps.gz
#
# The dates for 1997-1998 were altered by his successor, Rabbi Eli Suissa.
#
# The official announcements for the years 1997-1999 can be viewed at:
#
# ftp://ftp.huji.ac.il/pub/tz/announcements/YYYY.ps.gz
# ftp://ftp.cs.huji.ac.il/pub/tz/announcements/YYYY.ps.gz
#
# where YYYY is the relevant year.
@ -716,12 +716,12 @@ Rule Zion 1999 only - Sep 3 2:00 0 S
#
# The official announcement for the start date of 2000 can be viewed at:
#
# ftp://ftp.huji.ac.il/pub/tz/announcements/2000-start.ps.gz
# ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2000-start.ps.gz
#
# The official announcement for the end date of 2000 and the dates
# for the years 2001-2004 can be viewed at:
#
# ftp://ftp.huji.ac.il/pub/tz/announcements/2000-2004.ps.gz
# ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2000-2004.ps.gz
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Zion 2000 only - Apr 14 2:00 1:00 D
@ -735,52 +735,97 @@ Rule Zion 2003 only - Oct 3 1:00 0 S
Rule Zion 2004 only - Apr 7 1:00 1:00 D
Rule Zion 2004 only - Sep 22 1:00 0 S
# From Paul Eggert (2000-07-25):
# Here are guesses for rules after 2004.
# They are probably wrong, but they are more likely than no DST at all.
# Yesterday, the Knesset Interior Committee passed a proposed (originally
# in March 2004) change to the Time Setting Law that would make the dates
# for DST from 2005 and beyond so that DST starts on the night _after_ the
# first night of the Passover holiday at midnight until midnight of the
# Saturday night _before_ the fast of Yom Kippur.
#
# Those who can read Hebrew can view the proposal at:
#
# ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2005+.ps
#
# The proposal still has to be passed by the Knesset (three readings) for
# it to become law....
# From Paul Eggert (2004-12-22):
# For now, guess that the rules proposed on 2004-12-20 will be adopted.
# This is quite possibly wrong, but it is more likely than no DST at all.
# I used Ed Reingold's cal-hebrew in GNU Emacs 21.3, along with code
# written by Ephraim Silverberg, to generate this list.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Zion 2005 max - Apr 1 1:00 1:00 D
Rule Zion 2005 max - Oct 1 1:00 0 S
Rule Zion 2005 only - Apr 25 0:00 1:00 D
Rule Zion 2005 only - Oct 9 0:00 0 S
Rule Zion 2006 only - Apr 14 0:00 1:00 D
Rule Zion 2006 only - Oct 1 0:00 0 S
Rule Zion 2007 only - Apr 4 0:00 1:00 D
Rule Zion 2007 only - Sep 16 0:00 0 S
Rule Zion 2008 only - Apr 21 0:00 1:00 D
Rule Zion 2008 only - Oct 5 0:00 0 S
Rule Zion 2009 only - Apr 10 0:00 1:00 D
Rule Zion 2009 only - Sep 27 0:00 0 S
Rule Zion 2010 only - Mar 31 0:00 1:00 D
Rule Zion 2010 only - Sep 12 0:00 0 S
Rule Zion 2011 only - Apr 20 0:00 1:00 D
Rule Zion 2011 only - Oct 2 0:00 0 S
Rule Zion 2012 only - Apr 8 0:00 1:00 D
Rule Zion 2012 only - Sep 23 0:00 0 S
Rule Zion 2013 only - Mar 27 0:00 1:00 D
Rule Zion 2013 only - Sep 8 0:00 0 S
Rule Zion 2014 only - Apr 16 0:00 1:00 D
Rule Zion 2014 only - Sep 28 0:00 0 S
Rule Zion 2015 only - Apr 5 0:00 1:00 D
Rule Zion 2015 only - Sep 20 0:00 0 S
Rule Zion 2016 only - Apr 24 0:00 1:00 D
Rule Zion 2016 only - Oct 9 0:00 0 S
Rule Zion 2017 only - Apr 12 0:00 1:00 D
Rule Zion 2017 only - Sep 24 0:00 0 S
Rule Zion 2018 only - Apr 1 0:00 1:00 D
Rule Zion 2018 only - Sep 16 0:00 0 S
Rule Zion 2019 only - Apr 21 0:00 1:00 D
Rule Zion 2019 only - Oct 6 0:00 0 S
Rule Zion 2020 only - Apr 10 0:00 1:00 D
Rule Zion 2020 only - Sep 27 0:00 0 S
Rule Zion 2021 only - Mar 29 0:00 1:00 D
Rule Zion 2021 only - Sep 12 0:00 0 S
Rule Zion 2022 only - Apr 17 0:00 1:00 D
Rule Zion 2022 only - Oct 2 0:00 0 S
Rule Zion 2023 only - Apr 7 0:00 1:00 D
Rule Zion 2023 only - Sep 24 0:00 0 S
Rule Zion 2024 only - Apr 24 0:00 1:00 D
Rule Zion 2024 only - Oct 6 0:00 0 S
Rule Zion 2025 only - Apr 14 0:00 1:00 D
Rule Zion 2025 only - Sep 28 0:00 0 S
Rule Zion 2026 only - Apr 3 0:00 1:00 D
Rule Zion 2026 only - Sep 20 0:00 0 S
Rule Zion 2027 only - Apr 23 0:00 1:00 D
Rule Zion 2027 only - Oct 10 0:00 0 S
Rule Zion 2028 only - Apr 12 0:00 1:00 D
Rule Zion 2028 only - Sep 24 0:00 0 S
Rule Zion 2029 only - Apr 1 0:00 1:00 D
Rule Zion 2029 only - Sep 16 0:00 0 S
Rule Zion 2030 only - Apr 19 0:00 1:00 D
Rule Zion 2030 only - Oct 6 0:00 0 S
Rule Zion 2031 only - Apr 9 0:00 1:00 D
Rule Zion 2031 only - Sep 21 0:00 0 S
Rule Zion 2032 only - Mar 28 0:00 1:00 D
Rule Zion 2032 only - Sep 12 0:00 0 S
Rule Zion 2033 only - Apr 15 0:00 1:00 D
Rule Zion 2033 only - Oct 2 0:00 0 S
Rule Zion 2034 only - Apr 5 0:00 1:00 D
Rule Zion 2034 only - Sep 17 0:00 0 S
Rule Zion 2035 only - Apr 25 0:00 1:00 D
Rule Zion 2035 only - Oct 7 0:00 0 S
Rule Zion 2036 only - Apr 13 0:00 1:00 D
Rule Zion 2036 only - Sep 28 0:00 0 S
Rule Zion 2037 only - Apr 1 0:00 1:00 D
Rule Zion 2037 only - Sep 13 0:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Jerusalem 2:20:56 - LMT 1880
2:20:40 - JMT 1918 # Jerusalem Mean Time?
2:00 Zion I%sT
# From Ephraim Silverberg (2003-03-23):
#
# Minister of Interior Poraz has announced that he will respect the law
# passed in July 2000 (proposed at the time jointly by himself and
# then-MK David Azulai [Shas]) fixing the dates for 2000-2004. Hence,
# the dates for 2003 and 2004 remain unchanged....
#
# As far as 2005 and beyond, no dates have been set. However, the
# minister has mentioned that he wishes to propose to move Israel's
# timezone in 2005 from GMT+2 to GMT+3 and upon that have DST during
# the summer months (i.e. GMT+4). However, no legislation in this
# direction is expected until the latter part of 2004 which is a long
# time off in terms of Israeli politics.
# (2004-09-20):
# The latest rumour, however, is that in 2005, when the clock changes to
# Daylight Saving Time (date as yet unknown), the move will be a two-hour leap
# forward (from UTC+0200 to UTC+0400) and then, in the fall, the clock will
# move back only an hour to UTC+0300 thus effectively moving Israel's timezone
# from UTC+0200 to UTC+0300. However, no actual draft has been put before the
# Knesset (Israel's Parliament) though the intention is to do so this
# month [2004-09].
# (2004-09-26):
# Even though the draft law for the above did pass the Ministerial Committee
# for Legislative Matters three months ago, it was voted down in today's
# Cabinet meeting. The current suggestion is to keep the current timezone at
# UTC+0200 but have an extended period of Daylight Saving Time (UTC+0300) from
# the beginning of Passover holiday in the spring to after the Tabernacle
# holiday in the fall (i.e. the dates of which are governed by the Hebrew
# calendar but this means at least 184 days of DST). However, this is only a
# suggestion that was raised in today's cabinet meeting and has not yet been
# drafted.
###############################################################################

View File

@ -1,4 +1,4 @@
# @(#)backward 7.26
# @(#)backward 7.27
# This file provides links between current names for time zones
# and their old names. Many names changed in late 1993.
@ -13,7 +13,7 @@ Link America/Argentina/Jujuy America/Jujuy
Link America/Indiana/Knox America/Knox_IN
Link America/Argentina/Mendoza America/Mendoza
Link America/Rio_Branco America/Porto_Acre
Link America/Cordoba America/Rosario
Link America/Argentina/Cordoba America/Rosario
Link America/St_Thomas America/Virgin
Link Asia/Ashgabat Asia/Ashkhabad
Link Asia/Chongqing Asia/Chungking
@ -34,7 +34,7 @@ Link Australia/Hobart Australia/Tasmania
Link Australia/Melbourne Australia/Victoria
Link Australia/Perth Australia/West
Link Australia/Broken_Hill Australia/Yancowinna
Link America/Porto_Acre Brazil/Acre
Link America/Rio_Branco Brazil/Acre
Link America/Noronha Brazil/DeNoronha
Link America/Sao_Paulo Brazil/East
Link America/Manaus Brazil/West
@ -55,10 +55,10 @@ Link Europe/Dublin Eire
Link Europe/Chisinau Europe/Tiraspol
Link Europe/London GB
Link Europe/London GB-Eire
Link Etc/GMT+0 GMT+0
Link Etc/GMT-0 GMT-0
Link Etc/GMT0 GMT0
Link Etc/Greenwich Greenwich
Link Etc/GMT GMT+0
Link Etc/GMT GMT-0
Link Etc/GMT GMT0
Link Etc/GMT Greenwich
Link Asia/Hong_Kong Hongkong
Link Atlantic/Reykjavik Iceland
Link Asia/Tehran Iran
@ -70,7 +70,7 @@ Link Africa/Tripoli Libya
Link America/Tijuana Mexico/BajaNorte
Link America/Mazatlan Mexico/BajaSur
Link America/Mexico_City Mexico/General
Link America/Shiprock Navajo
Link America/Denver Navajo
Link Pacific/Auckland NZ
Link Pacific/Chatham NZ-CHAT
Link Pacific/Pago_Pago Pacific/Samoa
@ -95,6 +95,6 @@ Link America/Denver US/Mountain
Link America/Los_Angeles US/Pacific
Link Pacific/Pago_Pago US/Samoa
Link Etc/UTC UTC
Link Etc/Universal Universal
Link Etc/UTC Universal
Link Europe/Moscow W-SU
Link Etc/Zulu Zulu
Link Etc/UTC Zulu

View File

@ -1,4 +1,4 @@
# @(#)europe 7.88
# @(#)europe 7.91
# 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
@ -708,7 +708,7 @@ Zone Europe/Sofia 1:33:16 - LMT 1880
# see Serbia and Montenegro
# Cyprus
# See the `asia' file.
# Please see the `asia' file for Asia/Nicosia.
# Czech Republic
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
@ -754,6 +754,11 @@ Zone Atlantic/Faeroe -0:27:04 - LMT 1908 Jan 11 # Torshavn
0:00 - WET 1981
0:00 EU WE%sT
#
# From Paul Eggert (2004-10-31):
# During World War II, Germany maintained secret manned weather stations in
# East Greenland and Franz Josef Land, but we don't know their time zones.
# My source for this is Wilhelm Dege's book mentioned under Svalbard.
#
# From Paul Eggert (1996-11-22):
# Greenland joined the EU as part of Denmark, obtained home rule on 1979-05-01,
# and left the EU on 1985-02-01. It therefore should have been using EU
@ -1055,6 +1060,11 @@ Zone Europe/Berlin 0:53:28 - LMT 1893 Apr
1:00 Germany CE%sT 1980
1:00 EU CE%sT
# Georgia
# Please see the "asia" file for Asia/Tbilisi.
# Herodotus (Histories, IV.45) says Georgia north of the Phasis (now Rioni)
# is in Europe. Our reference location Tbilisi is in the Asian part.
# Gibraltar
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Europe/Gibraltar -0:21:24 - LMT 1880 Aug 2
@ -1611,7 +1621,7 @@ Zone Europe/Oslo 0:43:00 - LMT 1895 Jan 1
# From Paul Eggert (2001-05-01):
#
# Actually, Jan Mayen was never occupied by Germany during World War II,
# so it must have diverged from Oslo time during the war, as Olso was
# so it must have diverged from Oslo time during the war, as Oslo was
# keeping Berlin time.
#
# <http://home.no.net/janmayen/history.htm> says that the meteorologists
@ -1628,7 +1638,7 @@ Zone Europe/Oslo 0:43:00 - LMT 1895 Jan 1
# <http://www.svalbard.com/SvalbardFAQ.html> says that the Germans were
# expelled on 1942-05-14. However, small parties of Germans did return,
# and according to Wilhelm Dege's book "War North of 80" (1954)
# <http://www.utpress.utoronto.ca/publishing/rights/dege_warnorthof80.htm>
# <http://www.ucalgary.ca/UofC/departments/UP/1-55238/1-55238-110-2.html>
# the German armed forces at the Svalbard weather station code-named
# Haudegen did not surrender to the Allies until September 1945.
#

View File

@ -1,4 +1,4 @@
# @(#)leapseconds 7.17
# @(#)leapseconds 7.18
# Allowance for leapseconds added to each timezone file.
@ -45,7 +45,6 @@ Leap 1997 Jun 30 23:59:60 + S
Leap 1998 Dec 31 23:59:60 + S
# INTERNATIONAL EARTH ROTATION AND REFERENCE SYSTEMS SERVICE (IERS)
#
# SERVICE INTERNATIONAL DE LA ROTATION TERRESTRE ET DES SYSTEMES DE REFERENCE
#
# SERVICE DE LA ROTATION TERRESTRE
@ -55,9 +54,10 @@ Leap 1998 Dec 31 23:59:60 + S
# FAX : 33 (0) 1 40 51 22 91
# Internet : services.iers@obspm.fr
#
# Paris, 15 January 2004
# Paris, 21 July 2004
#
# Bulletin C 27
#
# Bulletin C 28
#
# To authorities responsible
# for the measurement and
@ -65,7 +65,7 @@ Leap 1998 Dec 31 23:59:60 + S
#
# INFORMATION ON UTC - TAI
#
# NO positive leap second will be introduced at the end of June 2004.
# NO positive leap second will be introduced at the end of December 2004.
# The difference between UTC and the International Atomic Time TAI is:
#
# from 1999 January 1, 0h UTC, until further notice : UTC-TAI = -32 s
@ -78,4 +78,3 @@ Leap 1998 Dec 31 23:59:60 + S
# Daniel GAMBIS
# Director
# Earth Orientation Center of IERS
# Observatoire de Paris, France

View File

@ -1,4 +1,4 @@
# @(#)northamerica 7.69
# @(#)northamerica 7.71
# also includes Central America and the Caribbean
# This data is by no means authoritative; if you think you know better,
@ -208,6 +208,13 @@ Rule US 1987 max - Apr Sun>=1 2:00 1:00 D
# Pennsylvania, Rhode Island, South Carolina, eastern Tennessee,
# Vermont, Virginia, West Virginia
# From Dave Cantor (2004-11-02):
# Early this summer I had the occasion to visit the Mount Washington
# Observatory weather station atop (of course!) Mount Washington [, NH]....
# One of the staff members said that the station was on Eastern Standard Time
# and didn't change their clocks for Daylight Saving ... so that their
# reports will always have times which are 5 hours behind UTC.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER
Rule NYC 1920 only - Mar lastSun 2:00 1:00 D
Rule NYC 1920 only - Oct lastSun 2:00 0 S
@ -355,10 +362,26 @@ Zone America/Adak 12:13:21 - LMT 1867 Oct 18
-11:00 US B%sT 1983 Oct 30 2:00
-10:00 US AH%sT 1983 Nov 30
-10:00 US HA%sT
# The following switches don't quite make our 1970 cutoff.
#
# Shanks writes that part of southwest Alaska (e.g. Aniak)
# switched from -11:00 to -10:00 on 1968-09-22 at 02:00,
# and another part (e.g. Akiak) made the same switch five weeks later.
# These switches don't quite make our 1970 cutoff.
#
# From David Flater (2004-11-09):
# In e-mail, 2004-11-02, Ray Hudson, historian/liaison to the Unalaska
# Historic Preservation Commission, provided this information, which
# suggests that Unalaska deviated from statutory time from early 1967
# possibly until 1983:
#
# Minutes of the Unalaska City Council Meeting, January 10, 1967:
# "Except for St. Paul and Akutan, Unalaska is the only important
# location not on Alaska Standard Time. The following resolution was
# made by William Robinson and seconded by Henry Swanson: Be it
# resolved that the City of Unalaska hereby goes to Alaska Standard
# Time as of midnight Friday, January 13, 1967 (1 A.M. Saturday,
# January 14, Alaska Standard Time.) This resolution was passed with
# three votes for and one against."
# Hawaii
#
@ -1731,6 +1754,15 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
# to DST--and one more hour on 1999-04-04--when the announcers will have
# returned to Baltimore, which switches on that date.)
# From Evert van der Veer via Steffen Thorsen (2004-10-28):
# Cuba is not going back to standard time this year.
# From Paul Eggert (2004-10-28):
# http://www.granma.cu/ingles/2004/septiembre/juev30/41medid-i.html
# says that it's due to a problem at the Antonio Guiteras
# thermoelectric plant, and says "This October there will be no return
# to normal hours (after daylight saving time)".
# For now, let's assume that it's a one-year temporary measure.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cuba 1928 only - Jun 10 0:00 1:00 D
Rule Cuba 1928 only - Oct 10 0:00 0 S
@ -1759,8 +1791,9 @@ Rule Cuba 1991 1995 - Oct Sun>=8 0:00s 0 S
Rule Cuba 1996 only - Oct 6 0:00s 0 S
Rule Cuba 1997 only - Oct 12 0:00s 0 S
Rule Cuba 1998 1999 - Mar lastSun 0:00s 1:00 D
Rule Cuba 1998 max - Oct lastSun 0:00s 0 S
Rule Cuba 1998 2003 - Oct lastSun 0:00s 0 S
Rule Cuba 2000 max - Apr Sun>=1 0:00s 1:00 D
Rule Cuba 2005 max - Oct lastSun 0:00s 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890

View File

@ -21,7 +21,7 @@
#ifndef lint
#ifndef NOID
static char privatehid[] = "@(#)private.h 7.54";
static char privatehid[] = "@(#)private.h 7.55";
#endif /* !defined NOID */
#endif /* !defined lint */
@ -208,6 +208,7 @@ extern char * asctime_r();
/*
** Private function declarations.
*/
char * icalloc P((int nelem, int elsize));
char * icatalloc P((char * old, const char * new));
char * icpyalloc P((const char * string));
@ -217,7 +218,6 @@ void icfree P((char * pointer));
void ifree P((char * pointer));
char * scheck P((const char *string, const char *format));
/*
** Finally, some convenience items.
*/
@ -238,6 +238,15 @@ char * scheck P((const char *string, const char *format));
#define TYPE_SIGNED(type) (((type) -1) < 0)
#endif /* !defined TYPE_SIGNED */
/*
** Since the definition of TYPE_INTEGRAL contains floating point numbers,
** it cannot be used in preprocessor directives.
*/
#ifndef TYPE_INTEGRAL
#define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
#endif /* !defined TYPE_INTEGRAL */
#ifndef INT_STRLEN_MAXIMUM
/*
** 302 / 1000 is log10(2.0) rounded up.

View File

@ -1,4 +1,4 @@
# @(#)southamerica 7.54
# @(#)southamerica 7.57
# 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
@ -671,7 +671,7 @@ Zone America/Campo_Grande -3:38:28 - LMT 1914
# Mato Grosso (MT)
Zone America/Cuiaba -3:44:20 - LMT 1914
-4:00 Brazil AM%sT 2003 Sep 24
-4:00 - AMT 2004 Oct 4
-4:00 - AMT 2004 Oct 1
-4:00 Brazil AM%sT
#
# west Para (PA), Rondonia (RO)
@ -942,9 +942,16 @@ Rule Para 1998 2001 - Mar Sun>=1 0:00 0 -
# A decree was issued in Paraguay (no. 16350) on 2002-02-26 that changed the
# dst method to be from the first Sunday in September to the first Sunday in
# April.
Rule Para 2002 max - Apr Sun>=1 0:00 0 -
Rule Para 2002 max - Sep Sun>=1 0:00 1:00 S
Rule Para 2002 2004 - Apr Sun>=1 0:00 0 -
Rule Para 2002 2003 - Sep Sun>=1 0:00 1:00 S
#
# From Jesper Norgaard Welen (2005-01-02):
# There are several sources that claim that Paraguay made
# a timezone rule change in autumn 2004.
# From Steffen Thorsen (2005-01-05):
# Decree 1,867 (2004-03-05) <http://www.labor.com.py/noticias.asp?id=27>
Rule Para 2004 max - Oct Sun>=15 0:00 1:00 S
Rule Para 2005 max - Mar Sun>=8 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Asuncion -3:50:40 - LMT 1890

View File

@ -21,7 +21,7 @@
#ifndef lint
#ifndef NOID
static char tzfilehid[] = "@(#)tzfile.h 7.14";
static char tzfilehid[] = "@(#)tzfile.h 7.16";
#endif /* !defined NOID */
#endif /* !defined lint */
@ -156,12 +156,21 @@ struct tzhead {
#define EPOCH_YEAR 1970
#define EPOCH_WDAY TM_THURSDAY
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
/*
** Accurate only for the past couple of centuries;
** that will probably do.
** Since everything in isleap is modulo 400 (or a factor of 400), we know that
** isleap(y) == isleap(y % 400)
** and so
** isleap(a + b) == isleap((a + b) % 400)
** or
** isleap(a + b) == isleap(a % 400 + b % 400)
** This is true even if % means modulo rather than Fortran remainder
** (which is allowed by C89 but not C99).
** We use this to avoid addition overflow problems.
*/
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
#ifndef USG

View File

@ -1,4 +1,4 @@
static char elsieid[] = "@(#)zdump.c 7.40";
static char elsieid[] = "@(#)zdump.c 7.61";
/*
** This code has been made independent of the rest of the time
@ -11,6 +11,15 @@ static char elsieid[] = "@(#)zdump.c 7.40";
#include "sys/types.h" /* for time_t */
#include "time.h" /* for struct tm */
#include "stdlib.h" /* for exit, malloc, atoi */
#include "float.h" /* for FLT_MAX and DBL_MAX */
#ifndef ZDUMP_LO_YEAR
#define ZDUMP_LO_YEAR (-500)
#endif /* !defined ZDUMP_LO_YEAR */
#ifndef ZDUMP_HI_YEAR
#define ZDUMP_HI_YEAR 2500
#endif /* !defined ZDUMP_HI_YEAR */
#ifndef MAX_STRING_LENGTH
#define MAX_STRING_LENGTH 1024
@ -61,9 +70,20 @@ static char elsieid[] = "@(#)zdump.c 7.40";
#endif /* !defined DAYSPERNYEAR */
#ifndef isleap
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
#endif /* !defined isleap */
#ifndef isleap_sum
/*
** See tzfile.h for details on isleap_sum.
*/
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
#endif /* !defined isleap_sum */
#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
#define SECSPERNYEAR (SECSPERDAY * DAYSPERNYEAR)
#define SECSPERLYEAR (SECSPERNYEAR + SECSPERDAY)
#if HAVE_GETTEXT
#include "locale.h" /* for setlocale */
#include "libintl.h"
@ -115,18 +135,60 @@ static char elsieid[] = "@(#)zdump.c 7.40";
extern char ** environ;
extern int getopt P((int argc, char * const argv[],
const char * options));
const char * options));
extern char * optarg;
extern int optind;
extern char * tzname[2];
static char * abbr P((struct tm * tmp));
static long delta P((struct tm * newp, struct tm * oldp));
static time_t hunt P((char * name, time_t lot, time_t hit));
static time_t absolute_min_time;
static time_t absolute_max_time;
static size_t longest;
static char * progname;
static void show P((char * zone, time_t t, int v));
static char * abbr P((struct tm * tmp));
static long delta P((struct tm * newp, struct tm * oldp));
static void dumptime P((const struct tm * tmp));
static time_t hunt P((char * name, time_t lot, time_t hit));
static void setabsolutes P((void));
static void show P((char * zone, time_t t, int v));
static const char * tformat P((void));
static time_t yeartot P((long y));
#ifndef TYPECHECK
#define my_localtime localtime
#else /* !defined TYPECHECK */
static struct tm *
my_localtime(tp)
time_t * tp;
{
register struct tm * tmp;
tmp = localtime(tp);
if (tp != NULL && tmp != NULL) {
struct tm tm;
register time_t t;
tm = *tmp;
t = mktime(&tm);
if (t - *tp >= 1 || *tp - t >= 1) {
(void) fflush(stdout);
(void) fprintf(stderr, "\n%s: ", progname);
(void) fprintf(stderr, tformat(), *tp);
(void) fprintf(stderr, " ->");
(void) fprintf(stderr, " sec %d", tmp->tm_sec);
(void) fprintf(stderr, " min %d", tmp->tm_min);
(void) fprintf(stderr, " hour %d", tmp->tm_hour);
(void) fprintf(stderr, " mday %d", tmp->tm_mday);
(void) fprintf(stderr, " mon %d", tmp->tm_mon);
(void) fprintf(stderr, " year %d", tmp->tm_year);
(void) fprintf(stderr, " -> ");
(void) fprintf(stderr, tformat(), t);
(void) fprintf(stderr, "\n");
}
}
return tmp;
}
#endif /* !defined TYPECHECK */
int
main(argc, argv)
@ -136,18 +198,22 @@ char * argv[];
register int i;
register int c;
register int vflag;
register char * cutoff;
register int cutyear;
register long cuttime;
char ** fakeenv;
register char * cutarg;
register long cutloyear = ZDUMP_LO_YEAR;
register long cuthiyear = ZDUMP_HI_YEAR;
register time_t cutlotime;
register time_t cuthitime;
register char ** fakeenv;
time_t now;
time_t t;
time_t newt;
time_t hibit;
struct tm tm;
struct tm newtm;
register struct tm * tmp;
register struct tm * newtmp;
INITIALIZE(cuttime);
INITIALIZE(cutlotime);
INITIALIZE(cuthitime);
#if HAVE_GETTEXT
(void) setlocale(LC_MESSAGES, "");
#ifdef TZ_DOMAINDIR
@ -162,39 +228,50 @@ char * argv[];
(void) exit(EXIT_SUCCESS);
}
vflag = 0;
cutoff = NULL;
cutarg = NULL;
while ((c = getopt(argc, argv, "c:v")) == 'c' || c == 'v')
if (c == 'v')
vflag = 1;
else cutoff = optarg;
else cutarg = optarg;
if ((c != EOF && c != -1) ||
(optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
(void) fprintf(stderr,
_("%s: usage is %s [ --version ] [ -v ] [ -c cutoff ] zonename ...\n"),
argv[0], argv[0]);
_("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
progname, progname);
(void) exit(EXIT_FAILURE);
}
if (cutoff != NULL) {
int y;
if (vflag) {
if (cutarg != NULL) {
long lo;
long hi;
char dummy;
cutyear = atoi(cutoff);
cuttime = 0;
for (y = EPOCH_YEAR; y < cutyear; ++y)
cuttime += DAYSPERNYEAR + isleap(y);
cuttime *= SECSPERHOUR * HOURSPERDAY;
if (sscanf(cutarg, "%ld%c", &hi, &dummy) == 1) {
cuthiyear = hi;
} else if (sscanf(cutarg, "%ld,%ld%c",
&lo, &hi, &dummy) == 2) {
cutloyear = lo;
cuthiyear = hi;
} else {
(void) fprintf(stderr, _("%s: wild -c argument %s\n"),
progname, cutarg);
(void) exit(EXIT_FAILURE);
}
}
setabsolutes();
cutlotime = yeartot(cutloyear);
cuthitime = yeartot(cuthiyear);
}
(void) time(&now);
longest = 0;
for (i = optind; i < argc; ++i)
if (strlen(argv[i]) > longest)
longest = strlen(argv[i]);
for (hibit = 1; (hibit << 1) != 0; hibit <<= 1)
continue;
{
register int from;
register int to;
for (i = 0; environ[i] != NULL; ++i)
for (i = 0; environ[i] != NULL; ++i)
continue;
fakeenv = (char **) malloc((size_t) ((i + 2) *
sizeof *fakeenv));
@ -219,58 +296,129 @@ _("%s: usage is %s [ --version ] [ -v ] [ -c cutoff ] zonename ...\n"),
show(argv[i], now, FALSE);
continue;
}
/*
** Get lowest value of t.
*/
t = hibit;
if (t > 0) /* time_t is unsigned */
t = 0;
t = absolute_min_time;
show(argv[i], t, TRUE);
t += SECSPERHOUR * HOURSPERDAY;
show(argv[i], t, TRUE);
tm = *localtime(&t);
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
if (t < cutlotime)
t = cutlotime;
tmp = my_localtime(&t);
if (tmp != NULL) {
tm = *tmp;
(void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
}
for ( ; ; ) {
if (cutoff != NULL && t >= cuttime)
if (t >= cuthitime)
break;
newt = t + SECSPERHOUR * 12;
if (cutoff != NULL && newt >= cuttime)
if (newt >= cuthitime)
break;
if (newt <= t)
break;
newtm = *localtime(&newt);
if (delta(&newtm, &tm) != (newt - t) ||
newtmp = localtime(&newt);
if (newtmp != NULL)
newtm = *newtmp;
if ((tmp == NULL || newtmp == NULL) ? (tmp != newtmp) :
(delta(&newtm, &tm) != (newt - t) ||
newtm.tm_isdst != tm.tm_isdst ||
strcmp(abbr(&newtm), buf) != 0) {
strcmp(abbr(&newtm), buf) != 0)) {
newt = hunt(argv[i], t, newt);
newtm = *localtime(&newt);
(void) strncpy(buf, abbr(&newtm),
(sizeof buf) - 1);
newtmp = localtime(&newt);
if (newtmp != NULL) {
newtm = *newtmp;
(void) strncpy(buf,
abbr(&newtm),
(sizeof buf) - 1);
}
}
t = newt;
tm = newtm;
tmp = newtmp;
}
/*
** Get highest value of t.
*/
t = ~((time_t) 0);
if (t < 0) /* time_t is signed */
t &= ~hibit;
t = absolute_max_time;
t -= SECSPERHOUR * HOURSPERDAY;
show(argv[i], t, TRUE);
t += SECSPERHOUR * HOURSPERDAY;
show(argv[i], t, TRUE);
}
if (fflush(stdout) || ferror(stdout)) {
(void) fprintf(stderr, "%s: ", argv[0]);
(void) fprintf(stderr, "%s: ", progname);
(void) perror(_("Error writing standard output"));
(void) exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);
/* If exit fails to exit... */
return EXIT_FAILURE;
}
/* gcc -Wall pacifier */
for ( ; ; )
continue;
static void
setabsolutes()
{
if (0.5 == (time_t) 0.5) {
/*
** time_t is floating.
*/
if (sizeof (time_t) == sizeof (float)) {
absolute_min_time = (time_t) -FLT_MAX;
absolute_max_time = (time_t) FLT_MAX;
} else if (sizeof (time_t) == sizeof (double)) {
absolute_min_time = (time_t) -DBL_MAX;
absolute_max_time = (time_t) DBL_MAX;
} else {
(void) fprintf(stderr,
_("%s: use of -v on system with floating time_t other than float or double\n"),
progname);
(void) exit(EXIT_FAILURE);
}
} else if (0 > (time_t) -1) {
/*
** time_t is signed.
*/
register time_t hibit;
for (hibit = 1; (hibit * 2) != 0; hibit *= 2)
continue;
absolute_min_time = hibit;
absolute_max_time = -(hibit + 1);
} else {
/*
** time_t is unsigned.
*/
absolute_min_time = 0;
absolute_max_time = absolute_min_time - 1;
}
}
static time_t
yeartot(y)
const long y;
{
register long myy;
register long seconds;
register time_t t;
myy = EPOCH_YEAR;
t = 0;
while (myy != y) {
if (myy < y) {
seconds = isleap(myy) ? SECSPERLYEAR : SECSPERNYEAR;
++myy;
if (t > absolute_max_time - seconds) {
t = absolute_max_time;
break;
}
t += seconds;
} else {
--myy;
seconds = isleap(myy) ? SECSPERLYEAR : SECSPERNYEAR;
if (t < absolute_min_time + seconds) {
t = absolute_min_time;
break;
}
t -= seconds;
}
}
return t;
}
static time_t
@ -279,25 +427,39 @@ char * name;
time_t lot;
time_t hit;
{
time_t t;
struct tm lotm;
struct tm tm;
static char loab[MAX_STRING_LENGTH];
time_t t;
long diff;
struct tm lotm;
register struct tm * lotmp;
struct tm tm;
register struct tm * tmp;
char loab[MAX_STRING_LENGTH];
lotm = *localtime(&lot);
(void) strncpy(loab, abbr(&lotm), (sizeof loab) - 1);
while ((hit - lot) >= 2) {
t = lot / 2 + hit / 2;
lotmp = my_localtime(&lot);
if (lotmp != NULL) {
lotm = *lotmp;
(void) strncpy(loab, abbr(&lotm), (sizeof loab) - 1);
}
for ( ; ; ) {
diff = (long) (hit - lot);
if (diff < 2)
break;
t = lot;
t += diff / 2;
if (t <= lot)
++t;
else if (t >= hit)
--t;
tm = *localtime(&t);
if (delta(&tm, &lotm) == (t - lot) &&
tmp = my_localtime(&t);
if (tmp != NULL)
tm = *tmp;
if ((lotmp == NULL || tmp == NULL) ? (lotmp == tmp) :
(delta(&tm, &lotm) == (t - lot) &&
tm.tm_isdst == lotm.tm_isdst &&
strcmp(abbr(&tm), loab) == 0) {
strcmp(abbr(&tm), loab) == 0)) {
lot = t;
lotm = tm;
lotmp = tmp;
} else hit = t;
}
show(name, lot, TRUE);
@ -314,14 +476,14 @@ delta(newp, oldp)
struct tm * newp;
struct tm * oldp;
{
long result;
int tmy;
register long result;
register int tmy;
if (newp->tm_year < oldp->tm_year)
return -delta(oldp, newp);
result = 0;
for (tmy = oldp->tm_year; tmy < newp->tm_year; ++tmy)
result += DAYSPERNYEAR + isleap(tmy + (long) TM_YEAR_BASE);
result += DAYSPERNYEAR + isleap_sum(tmy, TM_YEAR_BASE);
result += newp->tm_yday - oldp->tm_yday;
result *= HOURSPERDAY;
result += newp->tm_hour - oldp->tm_hour;
@ -338,22 +500,30 @@ char * zone;
time_t t;
int v;
{
struct tm * tmp;
register struct tm * tmp;
(void) printf("%-*s ", (int) longest, zone);
if (v) {
dumptime(gmtime(&t));
(void) printf(" UTC = ");
tmp = gmtime(&t);
if (tmp == NULL) {
(void) printf(tformat(), t);
} else {
dumptime(tmp);
(void) printf(" UTC");
}
(void) printf(" = ");
}
tmp = localtime(&t);
tmp = my_localtime(&t);
dumptime(tmp);
if (*abbr(tmp) != '\0')
(void) printf(" %s", abbr(tmp));
if (v) {
(void) printf(" isdst=%d", tmp->tm_isdst);
if (tmp != NULL) {
if (*abbr(tmp) != '\0')
(void) printf(" %s", abbr(tmp));
if (v) {
(void) printf(" isdst=%d", tmp->tm_isdst);
#ifdef TM_GMTOFF
(void) printf(" gmtoff=%ld", tmp->TM_GMTOFF);
(void) printf(" gmtoff=%ld", tmp->TM_GMTOFF);
#endif /* defined TM_GMTOFF */
}
}
(void) printf("\n");
}
@ -371,6 +541,33 @@ struct tm * tmp;
return (result == NULL) ? &nada : result;
}
/*
** The code below can fail on certain theoretical systems;
** it works on all known real-world systems as of 2004-12-30.
*/
static const char *
tformat()
{
if (0.5 == (time_t) 0.5) { /* floating */
if (sizeof (time_t) > sizeof (double))
return "%Lg";
return "%g";
}
if (0 > (time_t) -1) { /* signed */
if (sizeof (time_t) > sizeof (long))
return "%lld";
if (sizeof (time_t) > sizeof (int))
return "%ld";
return "%d";
}
if (sizeof (time_t) > sizeof (unsigned long))
return "%llu";
if (sizeof (time_t) > sizeof (unsigned int))
return "%lu";
return "%u";
}
static void
dumptime(timeptr)
register const struct tm * timeptr;
@ -384,7 +581,13 @@ register const struct tm * timeptr;
};
register const char * wn;
register const char * mn;
register int lead;
register int trail;
if (timeptr == NULL) {
(void) printf("NULL");
return;
}
/*
** The packaged versions of localtime and gmtime never put out-of-range
** values in tm_wday or tm_mon, but since this code might be compiled
@ -398,9 +601,23 @@ register const struct tm * timeptr;
(int) (sizeof mon_name / sizeof mon_name[0]))
mn = "???";
else mn = mon_name[timeptr->tm_mon];
(void) printf("%.3s %.3s%3d %.2d:%.2d:%.2d %ld",
(void) printf("%.3s %.3s%3d %.2d:%.2d:%.2d ",
wn, mn,
timeptr->tm_mday, timeptr->tm_hour,
timeptr->tm_min, timeptr->tm_sec,
timeptr->tm_year + (long) TM_YEAR_BASE);
timeptr->tm_min, timeptr->tm_sec);
#define DIVISOR 10
trail = timeptr->tm_year % DIVISOR + TM_YEAR_BASE % DIVISOR;
lead = timeptr->tm_year / DIVISOR + TM_YEAR_BASE / DIVISOR +
trail / DIVISOR;
trail %= DIVISOR;
if (trail < 0 && lead > 0) {
trail += DIVISOR;
--lead;
} else if (lead < 0 && trail > 0) {
trail -= DIVISOR;
++lead;
}
if (lead == 0)
(void) printf("%d", trail);
else (void) printf("%d%d", lead, ((trail < 0) ? -trail : trail));
}

View File

@ -1,4 +1,10 @@
static char elsieid[] = "@(#)zic.c 7.116";
static char elsieid[] = "@(#)zic.c 7.118";
/*
** Regardless of the type of time_t, we do our work using this type.
*/
typedef int zic_t;
#include "private.h"
#include "locale.h"
@ -50,7 +56,7 @@ struct rule {
const char * r_abbrvar; /* variable part of abbreviation */
int r_todo; /* a rule to do (used in outzone) */
time_t r_temp; /* used in outzone */
zic_t r_temp; /* used in outzone */
};
/*
@ -76,7 +82,7 @@ struct zone {
int z_nrules;
struct rule z_untilrule;
time_t z_untiltime;
zic_t z_untiltime;
};
extern int getopt P((int argc, char * const argv[],
@ -85,10 +91,10 @@ extern int link P((const char * fromname, const char * toname));
extern char * optarg;
extern int optind;
static void addtt P((time_t starttime, int type));
static void addtt P((zic_t starttime, int type));
static int addtype P((long gmtoff, const char * abbr, int isdst,
int ttisstd, int ttisgmt));
static void leapadd P((time_t t, int positive, int rolling, int count));
static void leapadd P((zic_t t, int positive, int rolling, int count));
static void adjleap P((void));
static void associate P((void));
static int ciequal P((const char * ap, const char * bp));
@ -121,13 +127,13 @@ static long oadd P((long t1, long t2));
static void outzone P((const struct zone * zp, int ntzones));
static void puttzcode P((long code, FILE * fp));
static int rcomp P((const void * leftp, const void * rightp));
static time_t rpytime P((const struct rule * rp, int wantedy));
static zic_t rpytime P((const struct rule * rp, int wantedy));
static void rulesub P((struct rule * rp,
const char * loyearp, const char * hiyearp,
const char * typep, const char * monthp,
const char * dayp, const char * timep));
static void setboundaries P((void));
static time_t tadd P((time_t t1, long t2));
static zic_t tadd P((zic_t t1, long t2));
static void usage P((void));
static void writezone P((const char * name));
static int yearistype P((int year, const char * type));
@ -141,10 +147,10 @@ static int errors;
static const char * filename;
static int leapcnt;
static int linenum;
static time_t max_time;
static zic_t max_time;
static int max_year;
static int max_year_representable;
static time_t min_time;
static zic_t min_time;
static int min_year;
static int min_year_representable;
static int noise;
@ -334,7 +340,7 @@ static const int len_years[2] = {
};
static struct attype {
time_t at;
zic_t at;
unsigned char type;
} attypes[TZ_MAX_TIMES];
static long gmtoffs[TZ_MAX_TYPES];
@ -343,7 +349,7 @@ static unsigned char abbrinds[TZ_MAX_TYPES];
static char ttisstds[TZ_MAX_TYPES];
static char ttisgmts[TZ_MAX_TYPES];
static char chars[TZ_MAX_CHARS];
static time_t trans[TZ_MAX_LEAPS];
static zic_t trans[TZ_MAX_LEAPS];
static long corr[TZ_MAX_LEAPS];
static char roll[TZ_MAX_LEAPS];
@ -629,7 +635,7 @@ const char * const tofile;
register char * symlinkcontents = NULL;
while ((s = strchr(s+1, '/')) != NULL)
symlinkcontents = ecatalloc(symlinkcontents, "../");
symlinkcontents = ecatalloc(symlinkcontents, fromname);
symlinkcontents = ecatalloc(symlinkcontents, fromfile);
result = unlink(toname);
if (result != 0 && errno != ENOENT) {
@ -676,25 +682,36 @@ warning(_("hard link failed, symbolic link used"));
*/
#define MAX_BITS_IN_FILE 32
#define TIME_T_BITS_IN_FILE ((TYPE_BIT(time_t) < MAX_BITS_IN_FILE) ? TYPE_BIT(time_t) : MAX_BITS_IN_FILE)
#define TIME_T_BITS_IN_FILE ((TYPE_BIT(zic_t) < MAX_BITS_IN_FILE) ? \
TYPE_BIT(zic_t) : MAX_BITS_IN_FILE)
static void
setboundaries P((void))
{
if (TYPE_SIGNED(time_t)) {
min_time = ~ (time_t) 0;
min_time <<= TIME_T_BITS_IN_FILE - 1;
max_time = ~ (time_t) 0 - min_time;
register int i;
if (TYPE_SIGNED(zic_t)) {
min_time = -1;
for (i = 0; i < TIME_T_BITS_IN_FILE - 1; ++i)
min_time *= 2;
max_time = -(min_time + 1);
if (sflag)
min_time = 0;
} else {
min_time = 0;
max_time = 2 - sflag;
max_time <<= TIME_T_BITS_IN_FILE - 1;
for (i = 0; i < TIME_T_BITS_IN_FILE - 1; ++i)
max_time *= 2;
--max_time;
}
min_year = TM_YEAR_BASE + gmtime(&min_time)->tm_year;
max_year = TM_YEAR_BASE + gmtime(&max_time)->tm_year;
{
time_t t;
t = (time_t) min_time;
min_year = TM_YEAR_BASE + gmtime(&t)->tm_year;
t = (time_t) max_time;
max_year = TM_YEAR_BASE + gmtime(&t)->tm_year;
}
min_year_representable = min_year;
max_year_representable = max_year;
}
@ -1120,7 +1137,7 @@ const int nfields;
register int i, j;
int year, month, day;
long dayoff, tod;
time_t t;
zic_t t;
if (nfields != LEAP_FIELDS) {
error(_("wrong number of fields on Leap line"));
@ -1164,7 +1181,7 @@ const int nfields;
return;
}
dayoff = oadd(dayoff, eitol(day - 1));
if (dayoff < 0 && !TYPE_SIGNED(time_t)) {
if (dayoff < 0 && !TYPE_SIGNED(zic_t)) {
error(_("time before zero"));
return;
}
@ -1176,7 +1193,7 @@ const int nfields;
error(_("time too large"));
return;
}
t = (time_t) dayoff * SECSPERDAY;
t = (zic_t) dayoff * SECSPERDAY;
tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE);
cp = fields[LP_CORR];
{
@ -1438,7 +1455,7 @@ const char * const name;
register int i, j;
static char * fullname;
static struct tzhead tzh;
time_t ats[TZ_MAX_TIMES];
zic_t ats[TZ_MAX_TIMES];
unsigned char types[TZ_MAX_TIMES];
/*
@ -1603,7 +1620,7 @@ const int zonecount;
register struct rule * rp;
register int i, j;
register int usestart, useuntil;
register time_t starttime, untiltime;
register zic_t starttime, untiltime;
register long gmtoff;
register long stdoff;
register int year;
@ -1672,7 +1689,7 @@ const int zonecount;
}
for ( ; ; ) {
register int k;
register time_t jtime, ktime;
register zic_t jtime, ktime;
register long offset;
char buf[BUFSIZ];
@ -1784,7 +1801,7 @@ error(_("can't determine time zone abbreviation to use just after until time"));
static void
addtt(starttime, type)
const time_t starttime;
const zic_t starttime;
int type;
{
if (starttime <= min_time ||
@ -1868,7 +1885,7 @@ const int ttisgmt;
static void
leapadd(t, positive, rolling, count)
const time_t t;
const zic_t t;
const int positive;
const int rolling;
int count;
@ -2056,12 +2073,12 @@ const long t2;
return t;
}
static time_t
static zic_t
tadd(t1, t2)
const time_t t1;
const zic_t t1;
const long t2;
{
register time_t t;
register zic_t t;
if (t1 == max_time && t2 > 0)
return max_time;
@ -2080,14 +2097,14 @@ const long t2;
** 1970, 00:00 LOCAL time - in that year that the rule refers to.
*/
static time_t
static zic_t
rpytime(rp, wantedy)
register const struct rule * const rp;
register const int wantedy;
{
register int y, m, i;
register long dayoff; /* with a nod to Margaret O. */
register time_t t;
register zic_t t;
if (wantedy == INT_MIN)
return min_time;
@ -2154,15 +2171,13 @@ register const int wantedy;
warning(_("rule goes past start/end of month--will not work with pre-2004 versions of zic"));
}
}
if (dayoff < 0 && !TYPE_SIGNED(time_t))
if (dayoff < 0 && !TYPE_SIGNED(zic_t))
return min_time;
if (dayoff < min_time / SECSPERDAY)
return min_time;
if (dayoff > max_time / SECSPERDAY)
return max_time;
t = (time_t) dayoff * SECSPERDAY;
if (t > 0 && max_time - t < rp->r_tod)
return max_time;
t = (zic_t) dayoff * SECSPERDAY;
return tadd(t, rp->r_tod);
}