Overview
Comment: | OFDate: Weakly link _mktime64() |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
005a10d3eca57fb43d75c2396eb654f2 |
User & Date: | js on 2020-05-16 17:55:05 |
Other Links: | manifest | tags |
Context
2020-05-16
| ||
18:17 | Better tests for local dates check-in: ce2822b26c user: js tags: trunk | |
17:55 | OFDate: Weakly link _mktime64() check-in: 005a10d3ec user: js tags: trunk | |
17:33 | OFFileURLHandler: Weakly link CreateHardLinkW() check-in: f803e7fa63 user: js tags: trunk | |
Changes
Modified src/OFDate.m from [b94395832f] to [249eca1bb1].
︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # define trunc(x) ((int64_t)(x)) #endif #if (!defined(HAVE_GMTIME_R) || !defined(HAVE_LOCALTIME_R)) && \ defined(OF_HAVE_THREADS) static OFMutex *mutex; #endif #ifdef HAVE_GMTIME_R # define GMTIME_RET(field) \ time_t seconds = (time_t)_seconds; \ struct tm tm; \ \ if (seconds != trunc(_seconds)) \ | > > > > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | # define trunc(x) ((int64_t)(x)) #endif #if (!defined(HAVE_GMTIME_R) || !defined(HAVE_LOCALTIME_R)) && \ defined(OF_HAVE_THREADS) static OFMutex *mutex; #endif #ifdef OF_WINDOWS static WINAPI __time64_t (*func__mktime64)(struct tm *); #endif #ifdef HAVE_GMTIME_R # define GMTIME_RET(field) \ time_t seconds = (time_t)_seconds; \ struct tm tm; \ \ if (seconds != trunc(_seconds)) \ |
︙ | ︙ | |||
182 183 184 185 186 187 188 | /* Time zone */ seconds += -(double)*tz * 60; return seconds; } @implementation OFDate | < < > > > > | > > > > | > | > > > > > | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | /* Time zone */ seconds += -(double)*tz * 60; return seconds; } @implementation OFDate + (void)initialize { #ifdef OF_WINDOWS HMODULE module; #endif if (self != [OFDate class]) return; #if (!defined(HAVE_GMTIME_R) || !defined(HAVE_LOCALTIME_R)) && \ defined(OF_HAVE_THREADS) mutex = [[OFMutex alloc] init]; #endif #ifdef OF_WINDOWS if ((module = LoadLibrary("msvcrt.dll")) != NULL) func__mktime64 = (WINAPI __time64_t (*)(struct tm *)) GetProcAddress(module, "_mktime64"); #endif } + (instancetype)date { return [[[self alloc] init] autorelease]; } + (instancetype)dateWithTimeIntervalSince1970: (of_time_interval_t)seconds |
︙ | ︙ | |||
313 314 315 316 317 318 319 | tm.tm_isdst = -1; if (of_strptime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; if (tz == INT16_MAX) { | | > | | > | > | | > > > | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | tm.tm_isdst = -1; if (of_strptime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; if (tz == INT16_MAX) { #ifdef OF_WINDOWS if (func__mktime64 != NULL) { if ((_seconds = func__mktime64(&tm)) == -1) @throw [OFInvalidFormatException exception]; } else { #endif if ((_seconds = mktime(&tm)) == -1) @throw [OFInvalidFormatException exception]; #ifdef OF_WINDOWS } #endif } else _seconds = tmAndTzToTime(&tm, &tz); } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ |