summaryrefslogtreecommitdiffstats
path: root/gl/m4/mktime.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/mktime.m4')
-rw-r--r--gl/m4/mktime.m431
1 files changed, 26 insertions, 5 deletions
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4
index 721189a..431b17d 100644
--- a/gl/m4/mktime.m4
+++ b/gl/m4/mktime.m4
@@ -1,5 +1,5 @@
1# serial 36 1# serial 37
2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, 2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2022 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
@@ -82,7 +82,8 @@ spring_forward_gap ()
82 instead of "TZ=America/Vancouver" in order to detect the bug even 82 instead of "TZ=America/Vancouver" in order to detect the bug even
83 on systems that don't support the Olson extension, or don't have the 83 on systems that don't support the Olson extension, or don't have the
84 full zoneinfo tables installed. */ 84 full zoneinfo tables installed. */
85 putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); 85 if (putenv ("TZ=PST8PDT,M4.1.0,M10.5.0") != 0)
86 return -1;
86 87
87 tm.tm_year = 98; 88 tm.tm_year = 98;
88 tm.tm_mon = 3; 89 tm.tm_mon = 3;
@@ -170,7 +171,8 @@ year_2050_test ()
170 instead of "TZ=America/Vancouver" in order to detect the bug even 171 instead of "TZ=America/Vancouver" in order to detect the bug even
171 on systems that don't support the Olson extension, or don't have the 172 on systems that don't support the Olson extension, or don't have the
172 full zoneinfo tables installed. */ 173 full zoneinfo tables installed. */
173 putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); 174 if (putenv ("TZ=PST8PDT,M4.1.0,M10.5.0") != 0)
175 return -1;
174 176
175 t = mktime (&tm); 177 t = mktime (&tm);
176 178
@@ -181,6 +183,25 @@ year_2050_test ()
181 || (0 < t && answer - 120 <= t && t <= answer + 120)); 183 || (0 < t && answer - 120 <= t && t <= answer + 120));
182} 184}
183 185
186static int
187indiana_test ()
188{
189 if (putenv ("TZ=America/Indiana/Indianapolis") != 0)
190 return -1;
191 struct tm tm;
192 tm.tm_year = 1986 - 1900; tm.tm_mon = 4 - 1; tm.tm_mday = 28;
193 tm.tm_hour = 16; tm.tm_min = 24; tm.tm_sec = 50; tm.tm_isdst = 0;
194 time_t std = mktime (&tm);
195 if (! (std == 515107490 || std == 515107503))
196 return 1;
197
198 /* This platform supports TZDB, either without or with leap seconds.
199 Return true if GNU Bug#48085 is absent. */
200 tm.tm_isdst = 1;
201 time_t dst = mktime (&tm);
202 return std - dst == 60 * 60;
203}
204
184int 205int
185main () 206main ()
186{ 207{
@@ -236,7 +257,7 @@ main ()
236 result |= 16; 257 result |= 16;
237 if (! spring_forward_gap ()) 258 if (! spring_forward_gap ())
238 result |= 32; 259 result |= 32;
239 if (! year_2050_test ()) 260 if (! year_2050_test () || ! indiana_test ())
240 result |= 64; 261 result |= 64;
241 return result; 262 return result;
242}]])], 263}]])],