Differences From Artifact [ae00d275b0]:
- File src/OFDate.m — part of check-in [7413a728a7] at 2024-04-03 02:16:03 on branch trunk — Change license to LGPLv3 only (user: js, size: 17919) [annotate] [blame] [check-ins using] [more...]
To Artifact [ddae0ab707]:
- File
src/OFDate.m
— part of check-in
[5164cbc576]
at
2024-05-01 15:20:29
on branch 1.1
— Document a lot of undocumented functions & macros
Also fixes Doxygen not creating documentation for `static OF_INLINE`
functions. (user: js, size: 17931) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
275 276 277 278 279 280 281 | if (seconds == 0) { static OFOnceControl once = OFOnceControlInitValue; OFOnce(&once, initZeroDate); return (id)zeroDate; } #if defined(OF_OBJFW_RUNTIME) && UINTPTR_MAX == UINT64_MAX | | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | if (seconds == 0) { static OFOnceControl once = OFOnceControlInitValue; OFOnce(&once, initZeroDate); return (id)zeroDate; } #if defined(OF_OBJFW_RUNTIME) && UINTPTR_MAX == UINT64_MAX value = OFFromBigEndian64(OFBitConvertDoubleToUInt64( OFToBigEndianDouble(seconds))); /* Almost all dates fall into this range. */ if (value & (UINT64_C(4) << 60)) { id ret = [OFTaggedPointerDate dateWithUInt64TimeIntervalSince1970: value]; if (ret != nil) |
︙ | ︙ | |||
411 412 413 414 415 416 417 | format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; short tz = 0; | | | | | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; short tz = 0; if (_OFStrPTime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; objc_autoreleasePoolPop(pool); return [self initWithTimeIntervalSince1970: tmAndTzToTime(&tm, tz)]; } - (instancetype)initWithLocalDateString: (OFString *)string format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; /* * _OFStrPTime() can never set this to SHRT_MAX, no matter what is * passed to it, so this is a safe way to figure out if the date * contains a time zone. */ short tz = SHRT_MAX; OFTimeInterval seconds; if (_OFStrPTime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; if (tz == SHRT_MAX) { #ifdef OF_WINDOWS if (_mktime64FuncPtr != NULL) { if ((seconds = _mktime64FuncPtr(&tm)) == -1) |
︙ | ︙ | |||
689 690 691 692 693 694 695 | } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = OFAllocMemory(1, pageSize); @try { | | | 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = OFAllocMemory(1, pageSize); @try { if (_OFStrFTime(buffer, pageSize, format.UTF8String, &tm, 0) == 0) @throw [OFOutOfRangeException exception]; ret = [OFString stringWithUTF8String: buffer]; } @finally { OFFreeMemory(buffer); } |
︙ | ︙ | |||
738 739 740 741 742 743 744 | } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = OFAllocMemory(1, pageSize); @try { | | | 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | } # endif #endif pageSize = [OFSystemInfo pageSize]; buffer = OFAllocMemory(1, pageSize); @try { if (_OFStrFTime(buffer, pageSize, format.UTF8String, &tm, 0) == 0) @throw [OFOutOfRangeException exception]; ret = [OFString stringWithUTF8String: buffer]; } @finally { OFFreeMemory(buffer); } |
︙ | ︙ |