OSX compatibility tweaks inspiered by testplant

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35555 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2012-09-10 05:18:09 +00:00
parent 5c55a3f1bd
commit ab65e628d3
5 changed files with 50 additions and 13 deletions

View file

@ -445,6 +445,20 @@ GSPrivateTimeNow(void)
* value of the receiver and adding the interval in seconds specified.
*/
- (id) addTimeInterval: (NSTimeInterval)seconds
{
return [self dateByAddingTimeInterval: seconds];
}
- (Class) classForCoder
{
return [self class];
}
/**
* Creates and returns a new NSCalendarDate object by taking the
* value of the receiver and adding the interval specified.
*/
- (id) dateByAddingTimeInterval: (NSTimeInterval)seconds
{
id newObj = [[self class] dateWithTimeIntervalSinceReferenceDate:
[self timeIntervalSinceReferenceDate] + seconds];
@ -455,11 +469,6 @@ GSPrivateTimeNow(void)
return newObj;
}
- (Class) classForCoder
{
return [self class];
}
- (id) replacementObjectForPortCoder: (NSPortCoder*)aRmc
{
return self;

View file

@ -1132,6 +1132,12 @@ otherTime(NSDate* other)
return self;
}
- (id) dateByAddingTimeInterval: (NSTimeInterval)seconds
{
return [[self class] dateWithTimeIntervalSinceReferenceDate:
otherTime(self) + seconds];
}
/**
* Returns an autoreleased instance of the [NSCalendarDate] class whose
* date/time value is the same as that of the receiver, and which uses
@ -1203,15 +1209,9 @@ otherTime(NSDate* other)
return [s autorelease];
}
/**
* Returns an autoreleased NSDate instance whose value if offset from
* that of the receiver by seconds.
*/
- (id) addTimeInterval: (NSTimeInterval)seconds
{
/* xxx We need to check for overflow? */
return [[self class] dateWithTimeIntervalSinceReferenceDate:
otherTime(self) + seconds];
return [self dateByAddingTimeInterval: seconds];
}
/**

View file

@ -105,7 +105,19 @@ static NSDate *theFuture = nil;
- (void) fire
{
[target performSelector: selector withObject: argument];
NS_DURING
{
[target performSelector: selector withObject: argument];
}
NS_HANDLER
{
NSLog(@"*** NSRunLoop ignoring exception '%@' (reason '%@') "
@"raised during performSelector... with target %p "
@"and selector '%@'",
[localException name], [localException reason], target,
NSStringFromSelector([target selector]));
}
NS_ENDHANDLER
}
- (id) initWithSelector: (SEL)aSelector