* lib/time-internal.h: Use HAVE_TZNAME_ARRAY instead of HAVE_TZNAME.
* lib/time_rz.c (tzalloc, save_abbr, mktime_z): Likewise.
* modules/time_rz (Depends-on): Add tzname.
* m4/time_rz.m4 (gl_TIME_RZ): Don't require AC_STRUCT_TIMEZONE.
+2024-06-06 Bruno Haible <bruno@clisp.org>
+
+ time_rz: Support time zone names on MSVC.
+ * lib/time-internal.h: Use HAVE_TZNAME_ARRAY instead of HAVE_TZNAME.
+ * lib/time_rz.c (tzalloc, save_abbr, mktime_z): Likewise.
+ * modules/time_rz (Depends-on): Add tzname.
+ * m4/time_rz.m4 (gl_TIME_RZ): Don't require AC_STRUCT_TIMEZONE.
+
2024-06-06 Bruno Haible <bruno@clisp.org>
tzname: Add tests.
/* Time internal interface
- Copyright 2015-2023 Free Software Foundation, Inc.
+ Copyright 2015-2024 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
members are zero. */
struct tm_zone *next;
-#if HAVE_TZNAME && !HAVE_STRUCT_TM_TM_ZONE
+#if HAVE_TZNAME_ARRAY && !HAVE_STRUCT_TM_TM_ZONE
/* Copies of recent strings taken from tzname[0] and tzname[1].
The copies are in ABBRS, so that they survive tzset. Null if unknown. */
char *tzname_copy[2];
/* Time zone functions such as tzalloc and localtime_rz
- Copyright 2015-2023 Free Software Foundation, Inc.
+ Copyright 2015-2024 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
if (tz)
{
tz->next = NULL;
-#if HAVE_TZNAME && !HAVE_STRUCT_TM_TM_ZONE
+#if HAVE_TZNAME_ARRAY && !HAVE_STRUCT_TM_TM_ZONE
tz->tzname_copy[0] = tz->tzname_copy[1] = NULL;
#endif
tz->tz_is_set = !!name;
return tz;
}
-/* Save into TZ any nontrivial time zone abbreviation used by TM, and
- update *TM (if HAVE_STRUCT_TM_TM_ZONE) or *TZ (if
- !HAVE_STRUCT_TM_TM_ZONE && HAVE_TZNAME) if they use the abbreviation.
+/* Save into TZ any nontrivial time zone abbreviation used by TM, and update
+ *TM (if HAVE_STRUCT_TM_TM_ZONE)
+ or *TZ (if !HAVE_STRUCT_TM_TM_ZONE && HAVE_TZNAME_ARRAY)
+ if they use the abbreviation.
Return true if successful, false (setting errno) otherwise. */
static bool
save_abbr (timezone_t tz, struct tm *tm)
{
-#if HAVE_STRUCT_TM_TM_ZONE || HAVE_TZNAME
+#if HAVE_STRUCT_TM_TM_ZONE || HAVE_TZNAME_ARRAY
char const *zone = NULL;
char *zone_copy = (char *) "";
-# if HAVE_TZNAME
+# if HAVE_TZNAME_ARRAY
int tzname_index = -1;
# endif
zone = tm->tm_zone;
# endif
-# if HAVE_TZNAME
+# if HAVE_TZNAME_ARRAY
if (! (zone && *zone) && 0 <= tm->tm_isdst)
{
tzname_index = tm->tm_isdst != 0;
tm_1.tm_isdst = tm->tm_isdst;
time_t t = mktime (&tm_1);
bool ok = 0 <= tm_1.tm_yday;
-#if HAVE_STRUCT_TM_TM_ZONE || HAVE_TZNAME
+#if HAVE_STRUCT_TM_TM_ZONE || HAVE_TZNAME_ARRAY
ok = ok && save_abbr (tz, &tm_1);
#endif
if (revert_tz (old_tz) && ok)
dnl Time zone functions: tzalloc, localtime_rz, etc.
-dnl Copyright (C) 2015-2023 Free Software Foundation, Inc.
+dnl Copyright (C) 2015-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,
dnl with or without modifications, as long as this notice is preserved.
[
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_TIME_H_DEFAULTS])
- AC_REQUIRE([AC_STRUCT_TIMEZONE])
# On Mac OS X 10.6, localtime loops forever with some time_t values.
# See Bug#27706, Bug#27736, and
c99
extensions
time-h
+tzname
flexmember [test $HAVE_TIMEZONE_T = 0]
idx [test $HAVE_TIMEZONE_T = 0]
setenv [test $HAVE_TIMEZONE_T = 0]