Differences From Artifact [396325df1e]:
- File
src/OFDate.m
— part of check-in
[4fc7884fb1]
at
2011-10-28 21:30:36
on branch trunk
— Parse struct tm ourselves.
This way, we don't need tm_gmtoff, which we would otherwise need to
adjust the value parsed by mktime, and don't need timegm either. (user: js, size: 12356) [annotate] [blame] [check-ins using]
To Artifact [11883eeeee]:
- File src/OFDate.m — part of check-in [f5c8495a33] at 2011-10-28 22:03:50 on branch trunk — Fix leap year calculation. (user: js, size: 12487) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
252 253 254 255 256 257 258 | #ifdef STRUCT_TM_HAS_TM_GMTOFF if (tm.tm_gmtoff != 0) @throw [OFInvalidFormatException exceptionWithClass: isa]; #endif /* Years */ | | | > > | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | #ifdef STRUCT_TM_HAS_TM_GMTOFF if (tm.tm_gmtoff != 0) @throw [OFInvalidFormatException exceptionWithClass: isa]; #endif /* Years */ seconds = (time_t)(tm.tm_year - 70) * 31536000; /* Leap years */ seconds += (((tm.tm_year + 1900) / 4) - 492) * 86400; seconds -= (((tm.tm_year + 1900) / 100) - 19) * 86400; seconds += (((tm.tm_year + 1900) / 400) - 4) * 86400; /* Months */ if (tm.tm_mon < 0 || tm.tm_mon > 12) @throw [OFInvalidFormatException exceptionWithClass: isa]; seconds += month_to_day_of_year[tm.tm_mon - 1] * 86400; /* Days */ seconds += (tm.tm_mday - 1) * 86400; |
︙ | ︙ |