MacTimeToTime(): ignore offset adjusted mktime() result if it didn't work

This commit is contained in:
rakslice 2025-01-30 03:44:25 -08:00
parent d66b125513
commit 70507f89da
2 changed files with 8 additions and 2 deletions

View File

@ -217,7 +217,10 @@ time_t MacTimeToTime(uint32 t)
if (out_tm) {
out_tm->tm_year -= yearofs;
out_tm->tm_mday -= dayofs;
out = mktime(out_tm);
time_t offset_adjusted = mktime(out_tm);
if (offset_adjusted != -1) {
out = offset_adjusted;
}
} else {
D(bug("MacTimeToTime: error applying offsets\n"));
}

View File

@ -477,7 +477,10 @@ time_t MacTimeToTime(uint32 t)
if (out_tm) {
out_tm->tm_year -= yearofs;
out_tm->tm_mday -= dayofs;
out = mktime(out_tm);
time_t offset_adjusted = mktime(out_tm);
if (offset_adjusted != -1) {
out = offset_adjusted;
}
} else {
D(bug("MacTimeToTime: error applying offsets\n"));
}