mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
SX compatibility tweak ... allow nil arg for -timeIntervalSinceDate:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34117 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d0807c3dec
commit
43c06d6065
2 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
2011-11-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSDate.m: ([-timeIntervalSinceDate:]) return NaN if other
|
||||
date is nil (OSX compatibility).
|
||||
|
||||
2011-11-02 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSNumber.m: Fix alignment error when encoding/decoding ...
|
||||
|
|
|
@ -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.<br />
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue