Differences From Artifact [2b9c35d972]:
- File src/OFDate.m — part of check-in [8892ae9fcc] at 2012-07-12 01:28:46 on branch trunk — Don't access isa directly. (user: js, size: 12940) [annotate] [blame] [check-ins using]
To Artifact [c0e29e0a91]:
- File
src/OFDate.m
— part of check-in
[417b213d41]
at
2012-07-16 23:49:50
on branch trunk
— Add OF_ENSURE.
This is to be used when the condition includes a statement that needs to
be executed, as with assert, this would not be executed anymore when
NDEBUG is defined. (user: js, size: 12926) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
18 19 20 21 22 23 24 | #define _GNU_SOURCE #include <stdint.h> #include <limits.h> #include <time.h> #include <math.h> #include <float.h> | < | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #define _GNU_SOURCE #include <stdint.h> #include <limits.h> #include <time.h> #include <math.h> #include <float.h> #include <sys/time.h> #import "OFDate.h" #import "OFString.h" #import "OFDictionary.h" #import "OFXMLElement.h" |
︙ | ︙ | |||
215 216 217 218 219 220 221 | - init { struct timeval t; self = [super init]; | | | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | - init { struct timeval t; self = [super init]; OF_ENSURE(!gettimeofday(&t, NULL)); seconds = t.tv_sec; seconds += (double)t.tv_usec / 1000000; return self; } |
︙ | ︙ | |||
621 622 623 624 625 626 627 | } - (double)timeIntervalSinceNow { struct timeval t; double seconds_; | | | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | } - (double)timeIntervalSinceNow { struct timeval t; double seconds_; OF_ENSURE(!gettimeofday(&t, NULL)); seconds_ = t.tv_sec; seconds_ += (double)t.tv_usec / 1000000; return seconds - seconds_; } - (OFDate*)dateByAddingTimeInterval: (double)seconds_ { return [OFDate dateWithTimeIntervalSince1970: seconds + seconds_]; } @end |