Differences From Artifact [7dd968f934]:
- File
src/OFDate.m
— part of check-in
[5d102d382e]
at
2011-11-02 11:20:00
on branch trunk
— Fix parsing of struct tm.
Only add an extra day for the current year if it is a leap year and it
is at least March. (user: js, size: 12644) [annotate] [blame] [check-ins using]
To Artifact [fb1894f71c]:
- File src/OFDate.m — part of check-in [bfdf9135d3] at 2011-11-23 00:21:05 on branch trunk — Add an implementation of strptime. (user: js, size: 12674) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" #import "macros.h" #if (!defined(HAVE_GMTIME_R) || !defined(HAVE_LOCALTIME_R)) && \ defined(OF_THREADS) static OFMutex *mutex; #endif #ifdef HAVE_GMTIME_R | > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfRangeException.h" #import "macros.h" #import "of_strptime.h" #if (!defined(HAVE_GMTIME_R) || !defined(HAVE_LOCALTIME_R)) && \ defined(OF_THREADS) static OFMutex *mutex; #endif #ifdef HAVE_GMTIME_R |
︙ | ︙ | |||
240 241 242 243 244 245 246 | self = [super init]; @try { struct tm tm = {}; tm.tm_isdst = -1; | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | self = [super init]; @try { struct tm tm = {}; tm.tm_isdst = -1; if (of_strptime([string UTF8String], [format UTF8String], &tm) == NULL) @throw [OFInvalidFormatException exceptionWithClass: isa]; #ifdef STRUCT_TM_HAS_TM_GMTOFF if (tm.tm_gmtoff != 0) @throw [OFInvalidFormatException |
︙ | ︙ | |||
293 294 295 296 297 298 299 | self = [super init]; @try { struct tm tm = {}; tm.tm_isdst = -1; | | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | self = [super init]; @try { struct tm tm = {}; tm.tm_isdst = -1; if (of_strptime([string UTF8String], [format UTF8String], &tm) == NULL) @throw [OFInvalidFormatException exceptionWithClass: isa]; if ((seconds = mktime(&tm)) == -1) @throw [OFInvalidFormatException exceptionWithClass: isa]; |
︙ | ︙ |