mirror of
git://sourceware.org/git/glibc.git
synced 2025-01-18 12:16:13 +08:00
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:
parent
59b64f9cbb
commit
61d64408a1
@ -189,7 +189,7 @@ __tzfile_read (const char *file, size_t extra, char **extrap)
|
|||||||
chars = (size_t) decode (tzhead.tzh_charcnt);
|
chars = (size_t) decode (tzhead.tzh_charcnt);
|
||||||
num_leaps = (size_t) decode (tzhead.tzh_leapcnt);
|
num_leaps = (size_t) decode (tzhead.tzh_leapcnt);
|
||||||
num_isstd = (size_t) decode (tzhead.tzh_ttisstdcnt);
|
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))
|
if (__glibc_unlikely (num_isstd > num_types || num_isgmt > num_types))
|
||||||
goto lose;
|
goto lose;
|
||||||
|
@ -132,11 +132,16 @@
|
|||||||
** Nested includes
|
** 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 localtime_rz sys_localtime_rz
|
||||||
#define mktime_z sys_mktime_z
|
#define mktime_z sys_mktime_z
|
||||||
#define posix2time_z sys_posix2time_z
|
#define posix2time_z sys_posix2time_z
|
||||||
#define time2posix_z sys_time2posix_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 timezone_t sys_timezone_t
|
||||||
#define tzalloc sys_tzalloc
|
#define tzalloc sys_tzalloc
|
||||||
#define tzfree sys_tzfree
|
#define tzfree sys_tzfree
|
||||||
@ -145,6 +150,9 @@
|
|||||||
#undef mktime_z
|
#undef mktime_z
|
||||||
#undef posix2time_z
|
#undef posix2time_z
|
||||||
#undef time2posix_z
|
#undef time2posix_z
|
||||||
|
#if defined USG_COMPAT && USG_COMPAT == 2
|
||||||
|
# undef timezone
|
||||||
|
#endif
|
||||||
#undef timezone_t
|
#undef timezone_t
|
||||||
#undef tzalloc
|
#undef tzalloc
|
||||||
#undef tzfree
|
#undef tzfree
|
||||||
@ -198,6 +206,14 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ALTZONE
|
||||||
|
# if defined __sun || defined _M_XENIX
|
||||||
|
# define ALTZONE 1
|
||||||
|
# else
|
||||||
|
# define ALTZONE 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef R_OK
|
#ifndef R_OK
|
||||||
#define R_OK 4
|
#define R_OK 4
|
||||||
#endif /* !defined R_OK */
|
#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;
|
typedef time_tz tz_time_t;
|
||||||
|
|
||||||
|
# undef asctime
|
||||||
|
# define asctime tz_asctime
|
||||||
|
# undef asctime_r
|
||||||
|
# define asctime_r tz_asctime_r
|
||||||
# undef ctime
|
# undef ctime
|
||||||
# define ctime tz_ctime
|
# define ctime tz_ctime
|
||||||
# undef ctime_r
|
# undef ctime_r
|
||||||
@ -473,11 +493,13 @@ typedef time_tz tz_time_t;
|
|||||||
# undef timezone
|
# undef timezone
|
||||||
# define timezone tz_timezone
|
# define timezone tz_timezone
|
||||||
# endif
|
# endif
|
||||||
# ifdef ALTZONE
|
# if ALTZONE
|
||||||
# undef altzone
|
# undef altzone
|
||||||
# define altzone tz_altzone
|
# define altzone tz_altzone
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
char *asctime(struct tm const *);
|
||||||
|
char *asctime_r(struct tm const *restrict, char *restrict);
|
||||||
char *ctime(time_t const *);
|
char *ctime(time_t const *);
|
||||||
char *ctime_r(time_t const *, char *);
|
char *ctime_r(time_t const *, char *);
|
||||||
double difftime(time_t, time_t) ATTRIBUTE_CONST;
|
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;
|
extern char **environ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TZ_TIME_T || !HAVE_POSIX_DECLS
|
#if 2 <= HAVE_TZNAME + (TZ_TIME_T || !HAVE_POSIX_DECLS)
|
||||||
# if HAVE_TZNAME
|
|
||||||
extern char *tzname[];
|
extern char *tzname[];
|
||||||
#endif
|
#endif
|
||||||
# if USG_COMPAT
|
#if 2 <= USG_COMPAT + (TZ_TIME_T || !HAVE_POSIX_DECLS)
|
||||||
extern long timezone;
|
extern long timezone;
|
||||||
extern int daylight;
|
extern int daylight;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#if 2 <= ALTZONE + (TZ_TIME_T || !HAVE_POSIX_DECLS)
|
||||||
|
|
||||||
#ifdef ALTZONE
|
|
||||||
extern long altzone;
|
extern long altzone;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@
|
|||||||
#define TZDEFRULES "posixrules"
|
#define TZDEFRULES "posixrules"
|
||||||
#endif /* !defined TZDEFRULES */
|
#endif /* !defined TZDEFRULES */
|
||||||
|
|
||||||
|
|
||||||
|
/* See Internet RFC 8536 for more details about the following format. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Each file begins with. . .
|
** Each file begins with. . .
|
||||||
*/
|
*/
|
||||||
@ -43,7 +46,7 @@ struct tzhead {
|
|||||||
char tzh_magic[4]; /* TZ_MAGIC */
|
char tzh_magic[4]; /* TZ_MAGIC */
|
||||||
char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */
|
char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */
|
||||||
char tzh_reserved[15]; /* reserved; must be zero */
|
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_ttisstdcnt[4]; /* coded number of trans. time flags */
|
||||||
char tzh_leapcnt[4]; /* coded number of leap seconds */
|
char tzh_leapcnt[4]; /* coded number of leap seconds */
|
||||||
char tzh_timecnt[4]; /* coded number of transition times */
|
char tzh_timecnt[4]; /* coded number of transition times */
|
||||||
@ -66,14 +69,15 @@ struct tzhead {
|
|||||||
** one (char [4]) total correction after above
|
** one (char [4]) total correction after above
|
||||||
** tzh_ttisstdcnt (char)s indexed by type; if 1, transition
|
** tzh_ttisstdcnt (char)s indexed by type; if 1, transition
|
||||||
** time is standard time, if 0,
|
** time is standard time, if 0,
|
||||||
** transition time is wall clock time
|
** transition time is local (wall clock)
|
||||||
** if absent, transition times are
|
** 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
|
|
||||||
** assumed to be local time
|
** 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1 +1 @@
|
|||||||
2018i
|
2020a
|
||||||
|
@ -328,12 +328,12 @@ abbrok(const char *const abbrp, const char *const zone)
|
|||||||
cp = abbrp;
|
cp = abbrp;
|
||||||
while (is_alpha(*cp) || is_digit(*cp) || *cp == '-' || *cp == '+')
|
while (is_alpha(*cp) || is_digit(*cp) || *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");
|
wp = _("has fewer than 3 characters");
|
||||||
else if (cp - abbrp > 6)
|
else if (cp - abbrp > 6)
|
||||||
wp = _("has more than 6 characters");
|
wp = _("has more than 6 characters");
|
||||||
else if (*cp)
|
|
||||||
wp = _("has characters other than ASCII alphanumerics, '-' or '+'");
|
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
778
timezone/zic.c
778
timezone/zic.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user