diff --git a/tests/expected/time/mktime.stdout b/tests/expected/time/mktime.stdout index c9b309e63c..b351ff41f3 100644 --- a/tests/expected/time/mktime.stdout +++ b/tests/expected/time/mktime.stdout @@ -4,3 +4,4 @@ -500 = -500 0 = 0 1531454950 = 1531454950 +gmtoff_ignored = 1 diff --git a/tests/time/mktime.c b/tests/time/mktime.c index bc8c9c755d..beaf01c4ef 100644 --- a/tests/time/mktime.c +++ b/tests/time/mktime.c @@ -57,4 +57,16 @@ int main(void) { printf("Comparison %ld == %ld failed. Time: %s", input, output, asctime(time)); } } + + // mktime must not panic on out-of-range tm_gmtoff + { + struct tm tg = { 0 }; + tg.tm_year = 124; + tg.tm_mon = 0; + tg.tm_mday = 1; + tg.tm_hour = 12; + tg.tm_gmtoff = 100000; + time_t result = mktime(&tg); + printf("gmtoff_ignored = %d\n", result != (time_t)-1); + } }