1 dnl Time zone functions: tzalloc, localtime_rz, etc.
3 dnl Copyright (C) 2015-2020 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl Written by Paul Eggert.
10 AC_DEFUN([gl_TIME_RZ],
12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
13 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
14 AC_REQUIRE([AC_STRUCT_TIMEZONE])
16 # On Mac OS X 10.6, localtime loops forever with some time_t values.
17 # See Bug#27706, Bug#27736, and
18 # https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html
19 AC_CACHE_CHECK([whether localtime works even near extrema],
20 [gl_cv_func_localtime_works],
21 [gl_cv_func_localtime_works=yes
29 time_t t = -67768038400666600;
31 char *tz = getenv ("TZ");
32 if (! (tz && strcmp (tz, "QQQ0") == 0))
36 /* Use TM and *TM to suppress over-optimization. */
37 return tm && tm->tm_isdst;
39 [(TZ=QQQ0 ./conftest$EXEEXT) >/dev/null 2>&1 ||
40 gl_cv_func_localtime_works=no],
42 [gl_cv_func_localtime_works="guessing yes"])])
43 if test "$gl_cv_func_localtime_works" = no; then
44 AC_DEFINE([HAVE_LOCALTIME_INFLOOP_BUG], 1,
45 [Define if localtime-like functions can loop forever on
49 AC_CHECK_TYPES([timezone_t], [], [], [[#include <time.h>]])
50 if test "$ac_cv_type_timezone_t" = yes; then