mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +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
19d0014c7c
commit
26f7e4b33d
2 changed files with 11 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue