+2024-06-16 Paul Eggert <eggert@cs.ucla.edu>
+
+ nstrftime: rename HAVE_TM_GMTOFF
+ * m4/tm_gmtoff.m4 (gl_TM_GMTOFF): Rename HAVE_TM_GMTOFF
+ to HAVE_STRUCT_TM_TM_GMTOFF, for consistency with
+ HAVE_STRUCT_TM_TM_ZONE. All uses changed.
+
2024-06-15 Bruno Haible <bruno@clisp.org>
Drop outdated cppi configuration.
return NULL;
}
-#if ! HAVE_TM_GMTOFF
+#if ! HAVE_STRUCT_TM_TM_GMTOFF
/* Yield the difference between *A and *B,
measured in seconds, ignoring leap seconds.
The body of this function is taken directly from the GNU C Library;
+ (a->tm_min - b->tm_min))
+ (a->tm_sec - b->tm_sec));
}
-#endif /* ! HAVE_TM_GMTOFF */
+#endif
static table const *
lookup_word (parser_control const *pc, char *word)
if (pc.zones_seen)
{
bool overflow = false;
-#ifdef HAVE_TM_GMTOFF
+#ifdef HAVE_STRUCT_TM_TM_GMTOFF
long int utcoff = tm.tm_gmtoff;
#else
time_t t = Start;
dbg_tm, sizeof dbg_tm));
if (localtime_rz (tz, &result->tv_sec, &lmt))
{
-#ifdef HAVE_TM_GMTOFF
+#ifdef HAVE_STRUCT_TM_TM_GMTOFF
bool got_utcoff = true;
long int utcoff = lmt.tm_gmtoff;
#else
#ifdef _LIBC
# define USE_IN_EXTENDED_LOCALE_MODEL 1
# define HAVE_STRUCT_ERA_ENTRY 1
-# define HAVE_TM_GMTOFF 1
+# define HAVE_STRUCT_TM_TM_GMTOFF 1
# define HAVE_STRUCT_TM_TM_ZONE 1
# define HAVE_TZNAME_ARRAY 1
# include "../locale/localeinfo.h"
#endif
-#if ! HAVE_TM_GMTOFF
+#if ! HAVE_STRUCT_TM_TM_GMTOFF
/* Yield the difference between *A and *B,
measured in seconds, ignoring leap seconds. */
# define tm_diff ftime_tm_diff
+ (a->tm_min - b->tm_min))
+ (a->tm_sec - b->tm_sec));
}
-#endif /* ! HAVE_TM_GMTOFF */
+#endif
int hour_diff;
int min_diff;
int sec_diff;
-#if HAVE_TM_GMTOFF
+#if HAVE_STRUCT_TM_TM_GMTOFF
diff = tp->tm_gmtoff;
#else
if (!tz)
}
if (val > 1200)
return NULL;
-#if defined _LIBC || HAVE_TM_GMTOFF
+#if defined _LIBC || HAVE_STRUCT_TM_TM_GMTOFF
tm->tm_gmtoff = (val * 3600) / 100;
if (neg)
tm->tm_gmtoff = -tm->tm_gmtoff;
# tm_gmtoff.m4
-# serial 3
+# serial 4
dnl Copyright (C) 2002, 2009-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_TM_GMTOFF],
[
- AC_CHECK_MEMBER([struct tm.tm_gmtoff],
- [AC_DEFINE([HAVE_TM_GMTOFF], [1],
- [Define if struct tm has the tm_gmtoff member.])],
- ,
- [#include <time.h>])
+ AC_CHECK_MEMBERS([struct tm.tm_gmtoff], [], [],
+ [[#include <time.h>
+ ]])
+
+ dnl Backward compatibility with 2024-and-earlier versions of this macro.
+ AS_IF([test "$ac_cv_member_struct_tm_tm_gmtoff" = yes],
+ [AC_DEFINE([HAVE_TM_GMTOFF], [1],
+ [Define if struct tm has the tm_gmtoff member.
+ This macro is obsolete.
+ New code should use HAVE_STRUCT_TM_TM_GMTOFF.])])
])
};
-#if ! HAVE_TM_GMTOFF
+#if ! HAVE_STRUCT_TM_TM_GMTOFF
/* Shift A right by B bits portably, by dividing A by 2**B and
truncating towards minus infinity. A and B should be free of side
effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
+ (a->tm_min - b->tm_min))
+ (a->tm_sec - b->tm_sec));
}
-#endif /* ! HAVE_TM_GMTOFF */
+#endif
static long
gmt_offset (time_t s)
{
long gmtoff;
-#if !HAVE_TM_GMTOFF
+#if !HAVE_STRUCT_TM_TM_GMTOFF
struct tm tm_local = *localtime (&s);
struct tm tm_gmt = *gmtime (&s);