diff options
| author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-08-23 17:13:04 +0200 |
|---|---|---|
| committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2022-08-23 17:13:04 +0200 |
| commit | bbdcf5a704517d35a76ba8b666075da9ffe39ac4 (patch) | |
| tree | a36bec4f7c2802dfe5efc5cb2dfc902fec2a23b8 /gl/m4/mktime.m4 | |
| parent | fa1ac7ecb247faf58fe65740c0d40e0585f684c9 (diff) | |
| download | monitoring-plugins-bbdcf5a.tar.gz | |
Sync with the latest Gnulib code (fa1ac7ec)
Diffstat (limited to 'gl/m4/mktime.m4')
| -rw-r--r-- | gl/m4/mktime.m4 | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4 index 721189af..431b17dc 100644 --- a/gl/m4/mktime.m4 +++ b/gl/m4/mktime.m4 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | # serial 36 | 1 | # serial 37 |
| 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, | 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009-2022 Free Software Foundation, |
| 3 | dnl Inc. | 3 | dnl Inc. |
| 4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl 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 | ||
| 186 | static int | ||
| 187 | indiana_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 | |||
| 184 | int | 205 | int |
| 185 | main () | 206 | main () |
| 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 | }]])], |
