Skip to content

Commit f3a8f38

Browse files
committed
IANA 2025a
2 parents 3944f75 + 7abdc14 commit f3a8f38

34 files changed

+1288
-883
lines changed

tz/Makefile

+17-15
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ TIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \
137137
uint_least64_t.ck
138138

139139
# What kind of TZif data files to generate. (TZif is the binary time
140-
# zone data format that zic generates; see Internet RFC 8536.)
140+
# zone data format that zic generates; see Internet RFC 9636.)
141141
# If you want only POSIX time, with time values interpreted as
142142
# seconds since the epoch (not counting leap seconds), use
143143
# REDO= posix_only
@@ -255,14 +255,15 @@ LDLIBS=
255255
# -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
256256
# -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
257257
# -Dlocale_t=XXX if your system uses XXX instead of locale_t
258+
# -DMKTIME_MIGHT_OVERFLOW if mktime might fail due to time_t overflow
258259
# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+
259260
# Typically it is better to use a later standard. For example,
260261
# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'.
261262
# Even with -DPORT_TO_C89, the code needs at least one C99
262263
# feature (integers at least 64 bits wide) and maybe more.
263264
# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
264265
# with external linkage, e.g., applications cannot define 'localtime'.
265-
# -Dssize_t=long on hosts like MS-Windows that lack ssize_t
266+
# -Dssize_t=int on hosts like MS-Windows that lack ssize_t
266267
# -DSUPPORT_C89=0 if the tzcode library should not support C89 callers
267268
# Although -DSUPPORT_C89=0 might work around latent bugs in callers,
268269
# it does not conform to POSIX.
@@ -285,7 +286,7 @@ LDLIBS=
285286
# This mishandles some past timestamps, as US DST rules have changed.
286287
# It also mishandles settings like TZ='EET-2EEST' for eastern Europe,
287288
# as Europe and US DST rules differ.
288-
# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255)
289+
# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 254)
289290
# -DUNINIT_TRAP if reading uninitialized storage can cause problems
290291
# other than simply getting garbage data
291292
# -DUSE_LTZ=0 to build zdump with the system time zone library
@@ -319,7 +320,8 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \
319320
$(GCC_INSTRUMENT) \
320321
-Wall -Wextra \
321322
-Walloc-size-larger-than=100000 -Warray-bounds=2 \
322-
-Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
323+
-Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wcast-qual \
324+
-Wdate-time \
323325
-Wdeclaration-after-statement -Wdouble-promotion \
324326
-Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \
325327
-Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
@@ -336,7 +338,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \
336338
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
337339
-Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \
338340
-Wvariadic-macros -Wvla -Wwrite-strings \
339-
-Wno-format-nonliteral -Wno-sign-compare
341+
-Wno-format-nonliteral -Wno-sign-compare -Wno-type-limits
340342
#
341343
# If your system has a "GMT offset" field in its "struct tm"s
342344
# (or if you decide to add such a field in your system's "time.h" file),
@@ -614,8 +616,8 @@ TZS_YEAR= 2050
614616
TZS_CUTOFF_FLAG= -c $(TZS_YEAR)
615617
TZS= to$(TZS_YEAR).tzs
616618
TZS_NEW= to$(TZS_YEAR)new.tzs
617-
TZS_DEPS= $(YDATA) asctime.c localtime.c \
618-
private.h tzfile.h zdump.c zic.c
619+
TZS_DEPS= $(YDATA) localtime.c private.h \
620+
strftime.c tzfile.h zdump.c zic.c
619621
TZDATA_DIST = $(COMMON) $(DATA) $(MISC)
620622
# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
621623
EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
@@ -855,10 +857,10 @@ tzselect: tzselect.ksh version
855857
chmod +x $@.out
856858
mv $@.out $@
857859
858-
check: check_mild back.ck
860+
check: check_mild back.ck now.ck
859861
check_mild: check_web check_zishrink \
860862
character-set.ck white-space.ck links.ck mainguard.ck \
861-
name-lengths.ck now.ck slashed-abbrs.ck sorted.ck \
863+
name-lengths.ck slashed-abbrs.ck sorted.ck \
862864
tables.ck ziguard.ck tzs.ck
863865
864866
# True if UTF8_LOCALE does not work;
@@ -1103,7 +1105,7 @@ set-timestamps.out: $(EIGHT_YARDS)
11031105
touch -md @1 test.out; then \
11041106
rm -f test.out && \
11051107
for file in $$files; do \
1106-
if git diff --quiet $$file; then \
1108+
if git diff --quiet HEAD $$file; then \
11071109
time=$$(TZ=UTC0 git log -1 \
11081110
--format='tformat:%cd' \
11091111
--date='format:%Y-%m-%dT%H:%M:%SZ' \
@@ -1354,13 +1356,13 @@ long-long.ck unsigned.ck: $(VERSION_DEPS)
13541356
zonenames: tzdata.zi
13551357
@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
13561358
1357-
asctime.o: private.h tzfile.h
1359+
asctime.o: private.h
13581360
date.o: private.h
13591361
difftime.o: private.h
1360-
localtime.o: private.h tzfile.h tzdir.h
1361-
strftime.o: private.h tzfile.h
1362-
zdump.o: version.h
1363-
zic.o: private.h tzfile.h tzdir.h version.h
1362+
localtime.o: private.h tzdir.h tzfile.h
1363+
strftime.o: localtime.c private.h tzdir.h tzfile.h
1364+
zdump.o: private.h version.h
1365+
zic.o: private.h tzdir.h tzfile.h version.h
13641366
13651367
.PHONY: ALL INSTALL all
13661368
.PHONY: check check_mild check_time_t_alternatives

tz/NEWS

+81-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,83 @@
11
News for the tz database
22

3+
Release 2025a - 2025-01-15 10:47:24 -0800
4+
5+
Briefly:
6+
Paraguay adopts permanent -03 starting spring 2024.
7+
Improve pre-1991 data for the Philippines.
8+
Etc/Unknown is now reserved.
9+
10+
Changes to future timestamps
11+
12+
Paraguay will stop changing its clocks after the spring-forward
13+
transition on 2024-10-06, so it is now permanently at -03.
14+
(Thanks to Heitor David Pinto and Even Scharning.)
15+
This affects timestamps starting 2025-03-22, as well as the
16+
obsolescent tm_isdst flags starting 2024-10-15.
17+
18+
Changes to past timestamps
19+
20+
Correct timestamps for the Philippines before 1900, and from 1937
21+
through 1990. (Thanks to P Chan for the heads-up and citations.)
22+
This includes adjusting local mean time before 1899; fixing
23+
transitions in September 1899, January 1937, and June 1954; adding
24+
transitions in December 1941, November 1945, March and September
25+
1977, and May and July 1990; and removing incorrect transitions in
26+
March and September 1978.
27+
28+
Changes to data
29+
30+
Add zone1970.tab lines for the Concordia and Eyre Bird Observatory
31+
research stations. (Thanks to Derick Rethans and Jule Dabars.)
32+
33+
Changes to code
34+
35+
strftime %s now generates the correct numeric string even when the
36+
represented number does not fit into time_t. This is better than
37+
generating the numeric equivalent of (time_t) -1, as strftime did
38+
in TZDB releases 96a (when %s was introduced) through 2020a and in
39+
releases 2022b through 2024b. It is also better than failing and
40+
returning 0, as strftime did in releases 2020b through 2022a.
41+
42+
strftime now outputs an invalid conversion specifier as-is,
43+
instead of eliding the leading '%', which confused debugging.
44+
45+
An invalid TZ now generates the time zone abbreviation "-00", not
46+
"UTC", to help the user see that an error has occurred. (Thanks
47+
to Arthur David Olson for suggesting a "wrong result".)
48+
49+
mktime and timeoff no longer incorrectly fail merely because a
50+
struct tm component near INT_MIN or INT_MAX overflows when a
51+
lower-order component carries into it.
52+
53+
TZNAME_MAXIMUM, the maximum number of bytes in a proleptic TZ
54+
string's time zone abbreviation, now defaults to 254 not 255.
55+
This helps reduce the size of internal state from 25480 to 21384
56+
on common platforms. This change should not be a problem, as
57+
nobody uses such long "abbreviations" and the longstanding tzcode
58+
maximum was 16 until release 2023a. For those who prefer no
59+
arbitrary limits, you can now specify TZNAME_MAXIMUM values up to
60+
PTRDIFF_MAX, a limit forced by C anyway; formerly tzcode silently
61+
misbehaved unless TZNAME_MAXIMUM was less than INT_MAX.
62+
63+
tzset and related functions no longer leak a file descriptor if
64+
another thread forks or execs at about the same time and if the
65+
platform has O_CLOFORK and O_CLOEXEC respectively. Also, the
66+
functions no longer let a TZif file become a controlling terminal.
67+
68+
'zdump -' now reads TZif data from /dev/stdin.
69+
(From a question by Arthur David Olson.)
70+
71+
Changes to documentation
72+
73+
The name Etc/Unknown is now reserved: it will not be used by TZDB.
74+
This is for compatibility with CLDR, which uses the string
75+
"Etc/Unknown" for an unknown or invalid timezone. (Thanks to
76+
Justin Grant, Mark Davis, and Guy Harris.)
77+
78+
Cite Internet RFC 9636, which obsoletes RFC 8536 for TZif format.
79+
80+
381
Release 2024b - 2024-09-04 12:27:47 -0700
482

583
Briefly:
@@ -116,7 +194,7 @@ Release 2024b - 2024-09-04 12:27:47 -0700
116194
Changes to commentary
117195

118196
Commentary about historical transitions in Portugal and her former
119-
colonies has been expanded with links to many relevant legislation.
197+
colonies has been expanded with links to relevant legislation.
120198
(Thanks to Tim Parenti.)
121199

122200

@@ -204,10 +282,10 @@ Release 2023d - 2023-12-21 20:02:24 -0800
204282
changing its time zone from -01/+00 to -02/-01 at the same moment
205283
as the spring-forward transition. Its clocks will therefore not
206284
spring forward as previously scheduled. The time zone change
207-
reverts to its common practice before 1981.
285+
reverts to its common practice before 1981. (Thanks to Jule Dabars.)
208286

209287
Fix predictions for DST transitions in Palestine in 2072-2075,
210-
correcting a typo introduced in 2023a.
288+
correcting a typo introduced in 2023a. (Thanks to Jule Dabars.)
211289

212290
Changes to past and future timestamps
213291

tz/antarctica

+2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ Zone Antarctica/Mawson 0 - -00 1954 Feb 13
174174

175175
# France & Italy - year-round base
176176
# Concordia, -750600+1232000, since 2005
177+
# https://en.wikipedia.org/wiki/Concordia_Station
178+
# Can use Asia/Singapore, which it has agreed with since inception.
177179

178180
# Germany - year-round base
179181
# Neumayer III, -704080-0081602, since 2009

tz/asctime.c

+66-52
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
/*
99
** Avoid the temptation to punt entirely to strftime;
10+
** strftime can behave badly when tm components are out of range, and
1011
** the output of strftime is supposed to be locale specific
1112
** whereas the output of asctime is supposed to be constant.
1213
*/
@@ -16,27 +17,6 @@
1617
#include "private.h"
1718
#include <stdio.h>
1819

19-
/*
20-
** All years associated with 32-bit time_t values are exactly four digits long;
21-
** some years associated with 64-bit time_t values are not.
22-
** Vintage programs are coded for years that are always four digits long
23-
** and may assume that the newline always lands in the same place.
24-
** For years that are less than four digits, we pad the output with
25-
** leading zeroes to get the newline in the traditional place.
26-
** The -4 ensures that we get four characters of output even if
27-
** we call a strftime variant that produces fewer characters for some years.
28-
** This conforms to recent ISO C and POSIX standards, which say behavior
29-
** is undefined when the year is less than 1000 or greater than 9999.
30-
*/
31-
static char const ASCTIME_FMT[] = "%s %s%3d %.2d:%.2d:%.2d %-4s\n";
32-
/*
33-
** For years that are more than four digits we put extra spaces before the year
34-
** so that code trying to overwrite the newline won't end up overwriting
35-
** a digit within a year and truncating the year (operating on the assumption
36-
** that no output is better than wrong output).
37-
*/
38-
static char const ASCTIME_FMT_B[] = "%s %s%3d %.2d:%.2d:%.2d %s\n";
39-
4020
enum { STD_ASCTIME_BUF_SIZE = 26 };
4121
/*
4222
** Big enough for something such as
@@ -50,14 +30,24 @@ enum { STD_ASCTIME_BUF_SIZE = 26 };
5030
*/
5131
static char buf_asctime[2*3 + 5*INT_STRLEN_MAXIMUM(int) + 7 + 2 + 1 + 1];
5232

53-
/* A similar buffer for ctime.
54-
C89 requires that they be the same buffer.
55-
This requirement was removed in C99, so support it only if requested,
56-
as support is more likely to lead to bugs in badly written programs. */
57-
#if SUPPORT_C89
58-
# define buf_ctime buf_asctime
59-
#else
60-
static char buf_ctime[sizeof buf_asctime];
33+
/* On pre-C99 platforms, a snprintf substitute good enough for us. */
34+
#if !HAVE_SNPRINTF
35+
# include <stdarg.h>
36+
ATTRIBUTE_FORMAT((printf, 3, 4)) static int
37+
my_snprintf(char *s, size_t size, char const *format, ...)
38+
{
39+
int n;
40+
va_list args;
41+
char stackbuf[sizeof buf_asctime];
42+
va_start(args, format);
43+
n = vsprintf(stackbuf, format, args);
44+
va_end (args);
45+
if (0 <= n && n < size)
46+
memcpy (s, stackbuf, n + 1);
47+
return n;
48+
}
49+
# undef snprintf
50+
# define snprintf my_snprintf
6151
#endif
6252

6353
/* Publish asctime_r and ctime_r only when supporting older POSIX. */
@@ -84,38 +74,59 @@ asctime_r(struct tm const *restrict timeptr, char *restrict buf)
8474
};
8575
register const char * wn;
8676
register const char * mn;
87-
char year[INT_STRLEN_MAXIMUM(int) + 2];
88-
char result[sizeof buf_asctime];
77+
int year, mday, hour, min, sec;
78+
long long_TM_YEAR_BASE = TM_YEAR_BASE;
79+
size_t bufsize = (buf == buf_asctime
80+
? sizeof buf_asctime : STD_ASCTIME_BUF_SIZE);
8981

9082
if (timeptr == NULL) {
83+
strcpy(buf, "??? ??? ?? ??:??:?? ????\n");
84+
/* Set errno now, since strcpy might change it in
85+
POSIX.1-2017 and earlier. */
9186
errno = EINVAL;
92-
return strcpy(buf, "??? ??? ?? ??:??:?? ????\n");
87+
return buf;
9388
}
9489
if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
9590
wn = "???";
9691
else wn = wday_name[timeptr->tm_wday];
9792
if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR)
9893
mn = "???";
9994
else mn = mon_name[timeptr->tm_mon];
100-
/*
101-
** Use strftime's %Y to generate the year, to avoid overflow problems
102-
** when computing timeptr->tm_year + TM_YEAR_BASE.
103-
** Assume that strftime is unaffected by other out-of-range members
104-
** (e.g., timeptr->tm_mday) when processing "%Y".
105-
*/
106-
strftime(year, sizeof year, "%Y", timeptr);
107-
/*
108-
** We avoid using snprintf since it's not available on all systems.
109-
*/
110-
sprintf(result,
111-
((strlen(year) <= 4) ? ASCTIME_FMT : ASCTIME_FMT_B),
112-
wn, mn,
113-
timeptr->tm_mday, timeptr->tm_hour,
114-
timeptr->tm_min, timeptr->tm_sec,
115-
year);
116-
if (strlen(result) < STD_ASCTIME_BUF_SIZE
117-
|| buf == buf_ctime || buf == buf_asctime)
118-
return strcpy(buf, result);
95+
96+
year = timeptr->tm_year;
97+
mday = timeptr->tm_mday;
98+
hour = timeptr->tm_hour;
99+
min = timeptr->tm_min;
100+
sec = timeptr->tm_sec;
101+
102+
/* Vintage programs are coded for years that are always four bytes long
103+
and may assume that the newline always lands in the same place.
104+
For years that are less than four bytes, pad the output with
105+
leading zeroes to get the newline in the traditional place.
106+
For years longer than four bytes, put extra spaces before the year
107+
so that vintage code trying to overwrite the newline
108+
won't overwrite a digit within a year and truncate the year,
109+
using the principle that no output is better than wrong output.
110+
This conforms to ISO C and POSIX standards, which say behavior
111+
is undefined when the year is less than 1000 or greater than 9999.
112+
113+
Also, avoid overflow when formatting tm_year + TM_YEAR_BASE. */
114+
115+
if ((year <= LONG_MAX - TM_YEAR_BASE
116+
? snprintf (buf, bufsize,
117+
((-999 - TM_YEAR_BASE <= year
118+
&& year <= 9999 - TM_YEAR_BASE)
119+
? "%s %s%3d %.2d:%.2d:%.2d %04ld\n"
120+
: "%s %s%3d %.2d:%.2d:%.2d %ld\n"),
121+
wn, mn, mday, hour, min, sec,
122+
year + long_TM_YEAR_BASE)
123+
: snprintf (buf, bufsize,
124+
"%s %s%3d %.2d:%.2d:%.2d %d%d\n",
125+
wn, mn, mday, hour, min, sec,
126+
year / 10 + TM_YEAR_BASE / 10,
127+
year % 10))
128+
< bufsize)
129+
return buf;
119130
else {
120131
errno = EOVERFLOW;
121132
return NULL;
@@ -140,5 +151,8 @@ ctime_r(const time_t *timep, char *buf)
140151
char *
141152
ctime(const time_t *timep)
142153
{
143-
return ctime_r(timep, buf_ctime);
154+
/* Do not call localtime_r, as C23 requires ctime to initialize the
155+
static storage that localtime updates. */
156+
struct tm *tmp = localtime(timep);
157+
return tmp ? asctime(tmp) : NULL;
144158
}

0 commit comments

Comments
 (0)