[tz] [PROPOSED PATCH 2/3] Port to NetBSD when using GCC_DEBUG_FLAGS or defining time_tz.
Paul Eggert
eggert at cs.ucla.edu
Fri Aug 15 05:53:46 UTC 2014
* private.h (offtime, posix2time, time2posix, timeoff) [time_tz]:
Define tz_* replacements for these functions too.
(asctime_r): Move to after time_tz definitions, to keep like
declarations together.
(tzsetwall) [STD_INSPIRED]: Declare if not defined.
(offtime, timeoff, time2posix, posix2time) [STD_INSPIRED]:
Declare if not defined, or if time_tz is defined.
* NEWS: Document this.
---
NEWS | 3 +++
private.h | 51 +++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/NEWS b/NEWS
index a8218f1..6affa5b 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,9 @@ Unreleased, experimental changes
tzselect -c now uses a hybrid distance measure that works better
in Africa. (Thanks to Alan Barrett for noting the problem.)
+ The C source code now ports to NetBSD when GCC_DEBUG_FLAGS is used,
+ or when time_tz is defined.
+
When HAVE_UTMPX_H is set the 'date' command now builds on systems
whose <utmpx.h> file does not define WTMPX_FILE, and when setting
the date it updates the wtmpx file if _PATH_WTMPX is defined.
diff --git a/private.h b/private.h
index ad22b9a..6f756a4 100644
--- a/private.h
+++ b/private.h
@@ -237,16 +237,6 @@ typedef unsigned long uintmax_t;
*/
/*
-** Some time.h implementations don't declare asctime_r.
-** Others might define it as a macro.
-** Fix the former without affecting the latter.
-*/
-
-#ifndef asctime_r
-extern char * asctime_r(struct tm const *, char *);
-#endif
-
-/*
** Compile with -Dtime_tz=T to build the tz package with a private
** time_t type equivalent to T rather than the system-supplied time_t.
** This debugging feature can test unusual design decisions
@@ -272,10 +262,18 @@ static time_t sys_time(time_t *x) { return time(x); }
# define localtime_r tz_localtime_r
# undef mktime
# define mktime tz_mktime
+# undef offtime
+# define offtime tz_offtime
+# undef posix2time
+# define posix2time tz_time2posix
# undef time
# define time tz_time
+# undef time2posix
+# define time2posix tz_time2posix
# undef time_t
# define time_t tz_time_t
+# undef timeoff
+# define timeoff tz_timeoff
typedef time_tz time_t;
@@ -299,6 +297,39 @@ time(time_t *p)
#endif
/*
+** Some time.h implementations don't declare asctime_r.
+** Others might define it as a macro.
+** Fix the former without affecting the latter.
+*/
+
+#ifndef asctime_r
+extern char * asctime_r(struct tm const *, char *);
+#endif
+
+/*
+** The STD_INSPIRED functions are similar, but most also need
+** declarations if time_tz is defined.
+*/
+
+#ifdef STD_INSPIRED
+# if !defined tzsetwall
+void tzsetwall(void);
+# endif
+# if !defined offtime || defined time_tz
+struct tm *offtime(time_t const *, long);
+# endif
+# if !defined timeoff || defined time_tz
+time_t timeoff(struct tm *, long);
+# endif
+# if !defined time2posix || defined time_tz
+time_t time2posix(time_t);
+# endif
+# if !defined posix2time || defined time_tz
+time_t posix2time(time_t);
+# endif
+#endif
+
+/*
** Private function declarations.
*/
--
1.9.1
More information about the tz
mailing list