summaryrefslogtreecommitdiff
path: root/lib/mktime-internal.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-08-31 18:02:48 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-09-01 00:22:53 -0700
commit65d3c969a07369768d028581fdc22fd09e447f2b (patch)
tree2e07dfdb78caaca6b7b729a9f13d6495d1ef55e3 /lib/mktime-internal.h
parent0e67e4f91c54fc74ae1cf653de544113c01e8a33 (diff)
downloadgnulib-65d3c969a07369768d028581fdc22fd09e447f2b.tar.gz
mktime, timegm: simplify merge to glibc
Move code around to make a merge to glibc easier to audit. This should not change behavior. * lib/mktime.c: Include more standard files unconditionally. (NEED_MKTIME_INTERNAL, NEED_MKTIME_WINDOWS) (NEED_MKTIME_WORKING): Give default values to pacify -Wundef, which glibc uses. Default NEED_MKTIME_WORKING to DEBUG_MKTIME, to simplify later conditionals; default the others to zero. In uses of these conditionals, explicitly spell out how _LIBC affects things, so it’s easier to review from a glibc viewpoint. (my_tzset, __tzset) [!_LIBC]: New function and macro, to better compartmentalize tzset issues. Move system-dependent tzsettish code here from mktime. (mktime): Move tzsettish code to my_tzset, and move localtime_offset to within mktime so that it doesn’t need a separate ifdef. * lib/mktime-internal.h (__gmtime_r, __localtime_r, __mktime_internal): Move these macros here from lib/mktime.c and lib/gmtime.c.
Diffstat (limited to 'lib/mktime-internal.h')
-rw-r--r--lib/mktime-internal.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h
index f531b55917..3e64156e8d 100644
--- a/lib/mktime-internal.h
+++ b/lib/mktime-internal.h
@@ -35,3 +35,19 @@ typedef int mktime_offset_t;
time_t mktime_internal (struct tm *,
struct tm * (*) (time_t const *, struct tm *),
mktime_offset_t *);
+
+/* Although glibc source code uses leading underscores, Gnulib wants
+ ordinary names.
+
+ Portable standalone applications should supply a <time.h> that
+ declares a POSIX-compliant localtime_r, for the benefit of older
+ implementations that lack localtime_r or have a nonstandard one.
+ Similarly for gmtime_r. See the gnulib time_r module for one way
+ to implement this. */
+
+#undef __gmtime_r
+#undef __localtime_r
+#define __gmtime_r gmtime_r
+#define __localtime_r localtime_r
+
+#define __mktime_internal mktime_internal