Update timezone code from tzcode 2020a

This patch updates files coming from tzcode to tzcode 2020a.
This is mostly for better support for Internet RFC 8536, by adding
support to zic for the Expires line (new to tzcode 2020a), the -b
option (new to 2019b) and the -r option (new to 2019a).
One trivial change to other glibc was needed.
* time/tzfile.c (__tzfile_read): Adjust to tzcode private.h renaming.
* timezone/private.h, timezone/tzfile.h, timezone/version:
* timezone/zdump.c, timezone/zic.c: Update from tzcode 2020a.
This commit is contained in:
Paul Eggert 2020-05-15 08:52:25 -07:00
parent 59b64f9cbb
commit 61d64408a1
6 changed files with 555 additions and 328 deletions

View File

@ -189,7 +189,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
chars = (size_t) decode (tzhead.tzh_charcnt);
num_leaps = (size_t) decode (tzhead.tzh_leapcnt);
num_isstd = (size_t) decode (tzhead.tzh_ttisstdcnt);
num_isgmt = (size_t) decode (tzhead.tzh_ttisgmtcnt);
num_isgmt = (size_t) decode (tzhead.tzh_ttisutcnt);
if (__glibc_unlikely (num_isstd > num_types || num_isgmt > num_types))
goto lose;

View File

@ -132,11 +132,16 @@
** Nested includes
*/
/* Avoid clashes with NetBSD by renaming NetBSD's declarations. */
/* Avoid clashes with NetBSD by renaming NetBSD's declarations.
If defining the 'timezone' variable, avoid a clash with FreeBSD's
'timezone' function by renaming its declaration. */
#define localtime_rz sys_localtime_rz
#define mktime_z sys_mktime_z
#define posix2time_z sys_posix2time_z
#define time2posix_z sys_time2posix_z
#if defined USG_COMPAT && USG_COMPAT == 2
# define timezone sys_timezone
#endif
#define timezone_t sys_timezone_t
#define tzalloc sys_tzalloc
#define tzfree sys_tzfree
@ -145,6 +150,9 @@
#undef mktime_z
#undef posix2time_z
#undef time2posix_z
#if defined USG_COMPAT && USG_COMPAT == 2
# undef timezone
#endif
#undef timezone_t
#undef tzalloc
#undef tzfree
@ -198,6 +206,14 @@
# endif
#endif
#ifndef ALTZONE
# if defined __sun || defined _M_XENIX
# define ALTZONE 1
# else
# define ALTZONE 0
# endif
#endif
#ifndef R_OK
#define R_OK 4
#endif /* !defined R_OK */
@ -409,6 +425,10 @@ static time_t sys_time(time_t *x) { return time(x); }
typedef time_tz tz_time_t;
# undef asctime
# define asctime tz_asctime
# undef asctime_r
# define asctime_r tz_asctime_r
# undef ctime
# define ctime tz_ctime
# undef ctime_r
@ -473,11 +493,13 @@ typedef time_tz tz_time_t;
# undef timezone
# define timezone tz_timezone
# endif
# ifdef ALTZONE
# if ALTZONE
# undef altzone
# define altzone tz_altzone
# endif
char *asctime(struct tm const *);
char *asctime_r(struct tm const *restrict, char *restrict);
char *ctime(time_t const *);
char *ctime_r(time_t const *, char *);
double difftime(time_t, time_t) ATTRIBUTE_CONST;
@ -512,17 +534,14 @@ extern char *asctime_r(struct tm const *restrict, char *restrict);
extern char **environ;
#endif
#if TZ_TIME_T || !HAVE_POSIX_DECLS
# if HAVE_TZNAME
#if 2 <= HAVE_TZNAME + (TZ_TIME_T || !HAVE_POSIX_DECLS)
extern char *tzname[];
# endif
# if USG_COMPAT
#endif
#if 2 <= USG_COMPAT + (TZ_TIME_T || !HAVE_POSIX_DECLS)
extern long timezone;
extern int daylight;
# endif
#endif
#ifdef ALTZONE
#if 2 <= ALTZONE + (TZ_TIME_T || !HAVE_POSIX_DECLS)
extern long altzone;
#endif

View File

@ -33,6 +33,9 @@
#define TZDEFRULES "posixrules"
#endif /* !defined TZDEFRULES */
/* See Internet RFC 8536 for more details about the following format. */
/*
** Each file begins with. . .
*/
@ -43,7 +46,7 @@ struct tzhead {
char tzh_magic[4]; /* TZ_MAGIC */
char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */
char tzh_reserved[15]; /* reserved; must be zero */
char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
char tzh_ttisutcnt[4]; /* coded number of trans. time flags */
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
char tzh_leapcnt[4]; /* coded number of leap seconds */
char tzh_timecnt[4]; /* coded number of transition times */
@ -66,14 +69,15 @@ struct tzhead {
** one (char [4]) total correction after above
** tzh_ttisstdcnt (char)s indexed by type; if 1, transition
** time is standard time, if 0,
** transition time is wall clock time
** if absent, transition times are
** assumed to be wall clock time
** tzh_ttisgmtcnt (char)s indexed by type; if 1, transition
** time is UT, if 0,
** transition time is local time
** if absent, transition times are
** transition time is local (wall clock)
** time; if absent, transition times are
** assumed to be local time
** tzh_ttisutcnt (char)s indexed by type; if 1, transition
** time is UT, if 0, transition time is
** local time; if absent, transition
** times are assumed to be local time.
** When this is 1, the corresponding
** std/wall indicator must also be 1.
*/
/*

View File

@ -1 +1 @@
2018i
2020a

View File

@ -328,12 +328,12 @@ abbrok(const char *const abbrp, const char *const zone)
cp = abbrp;
while (is_alpha(*cp) || is_digit(*cp) || *cp == '-' || *cp == '+')
++cp;
if (cp - abbrp < 3)
if (*cp)
wp = _("has characters other than ASCII alphanumerics, '-' or '+'");
else if (cp - abbrp < 3)
wp = _("has fewer than 3 characters");
else if (cp - abbrp > 6)
wp = _("has more than 6 characters");
else if (*cp)
wp = _("has characters other than ASCII alphanumerics, '-' or '+'");
else
return;
fflush(stdout);

File diff suppressed because it is too large Load Diff