test: add tm_gmtoff

This commit is contained in:
lyw458372
2026-06-08 19:39:55 +08:00
parent 8e11d7af70
commit 5a545a1e26
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -4,3 +4,4 @@
-500 = -500
0 = 0
1531454950 = 1531454950
gmtoff_ignored = 1
+12
View File
@@ -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);
}
}