Maybe there is an overflow?

This commit is contained in:
Ali 2023-04-27 22:18:17 +04:00
parent c6ac56a6ae
commit 3f013d9448

View File

@ -88,8 +88,8 @@ struct Month: Equatable {
var timeinfo: tm = tm()
gmtime_r(&time, &timeinfo)
let year = UInt32(timeinfo.tm_year)
let month = UInt32(timeinfo.tm_mon)
let year = UInt32(max(timeinfo.tm_year, 0))
let month = UInt32(max(timeinfo.tm_mon, 0))
self.packedValue = Int32(bitPattern: year | (month << 16))
}