Differences From Artifact [ada236f2a0]:
- File src/OFDate.m — part of check-in [504e13cf00] at 2017-05-13 22:38:02 on branch trunk — Reduce retain + autorelease (user: js, size: 14300) [annotate] [blame] [check-ins using]
To Artifact [388aebd154]:
- File
src/OFDate.m
— part of check-in
[3ba1a97679]
at
2017-05-14 23:31:21
on branch trunk
— OFDate: Don't use inf for -[distant{Future,Past}]
This way, they are no longer special cases. (user: js, size: 13948) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
218 219 220 221 222 223 224 | return [[[self alloc] initWithLocalDateString: string format: format] autorelease]; } + (instancetype)distantFuture { return [[[self alloc] | | | | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | return [[[self alloc] initWithLocalDateString: string format: format] autorelease]; } + (instancetype)distantFuture { return [[[self alloc] initWithTimeIntervalSince1970: 64060588800.0] autorelease]; } + (instancetype)distantPast { return [[[self alloc] initWithTimeIntervalSince1970: -62167219200.0] autorelease]; } - init { struct timeval t; self = [super init]; |
︙ | ︙ | |||
329 330 331 332 333 334 335 | - initWithSerialization: (OFXMLElement *)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); | < < < < < < < < | | < | 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 | - initWithSerialization: (OFXMLElement *)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); union { double d; uint64_t u; } d; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException exception]; d.u = OF_BSWAP64_IF_LE((uint64_t)[element hexadecimalValue]); _seconds = OF_BSWAP_DOUBLE_IF_LE(d.d); objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
418 419 420 421 422 423 424 | return OF_ORDERED_DESCENDING; return OF_ORDERED_SAME; } - (OFString *)description { | < < < | | | < < < < | < | 409 410 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 | return OF_ORDERED_DESCENDING; return OF_ORDERED_SAME; } - (OFString *)description { return [self dateStringWithFormat: @"%Y-%m-%dT%H:%M:%SZ"]; } - (OFXMLElement *)XMLElementBySerializing { void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; union { double d; uint64_t u; } d; element = [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS]; d.d = OF_BSWAP_DOUBLE_IF_LE(_seconds); [element setStringValue: [OFString stringWithFormat: @"%016" PRIx64, OF_BSWAP64_IF_LE(d.u)]]; [element retain]; objc_autoreleasePoolPop(pool); return [element autorelease]; } |
︙ | ︙ |