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:
rfm 2011-11-04 10:38:16 +00:00
parent 19d0014c7c
commit 26f7e4b33d
2 changed files with 11 additions and 1 deletions

View file

@ -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);
}