mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2025-11-21 10:51:49 +00:00
Simplify configuration of TM_GMTOFF and TM_ZONE.
* private.h, zdump.c (_GNU_SOURCE): New macro. (TM_GMTOFF) [!NO_TM_GMTOFF]: (TM_ZONE) [!NO_TM_ZONE]: Guess definition if not already defined. * Makefile, NEWS: Document the above.
This commit is contained in:
23
Makefile
23
Makefile
@ -161,25 +161,12 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
|
||||
# (or if you decide to add such a field in your system's "time.h" file),
|
||||
# add the name to a define such as
|
||||
# -DTM_GMTOFF=tm_gmtoff
|
||||
# or
|
||||
# -DTM_GMTOFF=_tm_gmtoff
|
||||
# to the end of the "CFLAGS=" line.
|
||||
# Neither tm_gmtoff nor _tm_gmtoff is described in X3J11's work;
|
||||
# in its work, use of "tm_gmtoff" is described as non-conforming.
|
||||
# Both Linux and BSD have done the equivalent of defining TM_GMTOFF in
|
||||
# their recent releases.
|
||||
#
|
||||
# If your system has a "zone abbreviation" field in its "struct tm"s
|
||||
# (or if you decide to add such a field in your system's "time.h" file),
|
||||
# add the name to a define such as
|
||||
# to the end of the "CFLAGS=" line. If not defined, the code attempts to
|
||||
# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this.
|
||||
# Similarly, if your system has a "zone abbreviation" field, define
|
||||
# -DTM_ZONE=tm_zone
|
||||
# or
|
||||
# -DTM_ZONE=_tm_zone
|
||||
# to the end of the "CFLAGS=" line.
|
||||
# Neither tm_zone nor _tm_zone is described in X3J11's work;
|
||||
# in its work, use of "tm_zone" is described as non-conforming.
|
||||
# Both UCB and Sun have done the equivalent of defining TM_ZONE in
|
||||
# their recent releases.
|
||||
# and define NO_TM_ZONE to suppress any guessing. These two fields are not
|
||||
# required by POSIX, but are widely available on GNU/Linux and BSD systems.
|
||||
#
|
||||
# If you want functions that were inspired by early versions of X3J11's work,
|
||||
# add
|
||||
|
||||
4
NEWS
4
NEWS
@ -51,6 +51,10 @@ Unreleased, experimental changes
|
||||
Although not needed for tz's own applications, which are single-threaded,
|
||||
this supports POSIX better if the tz library is used in multithreaded apps.
|
||||
|
||||
The tz code now attempts to infer TM_GMTOFF and TM_ZONE if not
|
||||
already defined, to make it easier to configure on common platforms.
|
||||
Define NO_TM_GMTOFF and NO_TM_ZONE to suppress this.
|
||||
|
||||
tzselect -c now uses a hybrid distance measure that works better
|
||||
in Africa. (Thanks to Alan Barrett for noting the problem.)
|
||||
|
||||
|
||||
16
private.h
16
private.h
@ -71,6 +71,9 @@
|
||||
#define ctime_r _incompatible_ctime_r
|
||||
#endif /* HAVE_INCOMPATIBLE_CTIME_R */
|
||||
|
||||
/* Enable tm_gmtoff and tm_zone on GNUish systems. */
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
/*
|
||||
** Nested includes
|
||||
*/
|
||||
@ -337,6 +340,19 @@ time_t posix2time(time_t);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Infer TM_ZONE on systems where this information is known, but suppress
|
||||
guessing if NO_TM_ZONE is defined. Similarly for TM_GMTOFF. */
|
||||
#if (defined __GLIBC__ \
|
||||
|| defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \
|
||||
|| (defined __APPLE__ && defined __MACH__))
|
||||
# if !defined TM_GMTOFF && !defined NO_TM_GMTOFF
|
||||
# define TM_GMTOFF tm_gmtoff
|
||||
# endif
|
||||
# if !defined TM_ZONE && !defined NO_TM_ZONE
|
||||
# define TM_ZONE tm_zone
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Private function declarations.
|
||||
*/
|
||||
|
||||
16
zdump.c
16
zdump.c
@ -18,6 +18,9 @@
|
||||
# include "private.h"
|
||||
#endif
|
||||
|
||||
/* Enable tm_gmtoff and tm_zone on GNUish systems. */
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
#include "stdio.h" /* for stdout, stderr, perror */
|
||||
#include "string.h" /* for strcpy */
|
||||
#include "sys/types.h" /* for time_t */
|
||||
@ -73,6 +76,19 @@ typedef long intmax_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Infer TM_ZONE on systems where this information is known, but suppress
|
||||
guessing if NO_TM_ZONE is defined. Similarly for TM_GMTOFF. */
|
||||
#if (defined __GLIBC__ \
|
||||
|| defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \
|
||||
|| (defined __APPLE__ && defined __MACH__))
|
||||
# if !defined TM_GMTOFF && !defined NO_TM_GMTOFF
|
||||
# define TM_GMTOFF tm_gmtoff
|
||||
# endif
|
||||
# if !defined TM_ZONE && !defined NO_TM_ZONE
|
||||
# define TM_ZONE tm_zone
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ZDUMP_LO_YEAR
|
||||
#define ZDUMP_LO_YEAR (-500)
|
||||
|
||||
Reference in New Issue
Block a user