diff --git a/ChangeLog b/ChangeLog index e5c8e5aad..4aa624fa7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-11-04 Richard Frith-Macdonald + + * Source/NSDate.m: ([-timeIntervalSinceDate:]) return NaN if other + date is nil (OSX compatibility). + 2011-11-02 Richard Frith-Macdonald * Source/NSNumber.m: Fix alignment error when encoding/decoding ... diff --git a/Source/NSDate.m b/Source/NSDate.m index 4d7769859..3f56ff573 100644 --- a/Source/NSDate.m +++ b/Source/NSDate.m @@ -1226,15 +1226,20 @@ otherTime(NSDate* other) /** * Returns the time interval between the receivers value and that of the * otherDate argument. If otherDate is earlier than the receiver, the - * returned value will be positive, if it is later it will be negative. + * returned value will be positive, if it is later it will be negative.
+ * For current (2011) OSX compatibility, this method returns NaN if otherDate + * is nil ... do not write code depending on that behavior. */ - (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate { if (otherDate == nil) + return nan(""); +/* { [NSException raise: NSInvalidArgumentException format: @"nil argument for timeIntervalSinceDate:"]; } +*/ return otherTime(self) - otherTime(otherDate); }