mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 16:20:42 +00:00
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:
parent
5c55a3f1bd
commit
ab65e628d3
5 changed files with 50 additions and 13 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2012-09-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Headers/Foundation/NSDate.h: Declare new OSX method to add time
|
||||||
|
interval to a date.
|
||||||
|
* Source/NSDate.m: Implement it
|
||||||
|
* Source/NSCalendarDate.m: Ditto
|
||||||
|
* Source/NSRunLoop.m: Add exception handling for run loop performer.
|
||||||
|
|
||||||
2012-09-10 Sergii Stoian <stoyan255@gmail.com>
|
2012-09-10 Sergii Stoian <stoyan255@gmail.com>
|
||||||
|
|
||||||
* Source/NSFileManager.m:
|
* Source/NSFileManager.m:
|
||||||
|
|
|
@ -106,6 +106,14 @@ GS_EXPORT const NSTimeInterval NSTimeIntervalSince1970;
|
||||||
- (BOOL) isEqualToDate: (NSDate*)other;
|
- (BOOL) isEqualToDate: (NSDate*)other;
|
||||||
- (NSDate*) laterDate: (NSDate*)otherDate;
|
- (NSDate*) laterDate: (NSDate*)otherDate;
|
||||||
|
|
||||||
|
#if OS_API_VERSION(100600,GS_API_LATEST)
|
||||||
|
/**
|
||||||
|
* Returns an autoreleased NSDate instance whose value is offset from
|
||||||
|
* that of the receiver by the specified interval.
|
||||||
|
*/
|
||||||
|
- (id) dateByAddingTimeInterval: (NSTimeInterval)ti;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||||
+ (id) dateWithNaturalLanguageString: (NSString*)string;
|
+ (id) dateWithNaturalLanguageString: (NSString*)string;
|
||||||
+ (id) dateWithNaturalLanguageString: (NSString*)string
|
+ (id) dateWithNaturalLanguageString: (NSString*)string
|
||||||
|
|
|
@ -445,6 +445,20 @@ GSPrivateTimeNow(void)
|
||||||
* value of the receiver and adding the interval in seconds specified.
|
* value of the receiver and adding the interval in seconds specified.
|
||||||
*/
|
*/
|
||||||
- (id) addTimeInterval: (NSTimeInterval)seconds
|
- (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:
|
id newObj = [[self class] dateWithTimeIntervalSinceReferenceDate:
|
||||||
[self timeIntervalSinceReferenceDate] + seconds];
|
[self timeIntervalSinceReferenceDate] + seconds];
|
||||||
|
@ -455,11 +469,6 @@ GSPrivateTimeNow(void)
|
||||||
return newObj;
|
return newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (Class) classForCoder
|
|
||||||
{
|
|
||||||
return [self class];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id) replacementObjectForPortCoder: (NSPortCoder*)aRmc
|
- (id) replacementObjectForPortCoder: (NSPortCoder*)aRmc
|
||||||
{
|
{
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -1132,6 +1132,12 @@ otherTime(NSDate* other)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id) dateByAddingTimeInterval: (NSTimeInterval)seconds
|
||||||
|
{
|
||||||
|
return [[self class] dateWithTimeIntervalSinceReferenceDate:
|
||||||
|
otherTime(self) + seconds];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an autoreleased instance of the [NSCalendarDate] class whose
|
* Returns an autoreleased instance of the [NSCalendarDate] class whose
|
||||||
* date/time value is the same as that of the receiver, and which uses
|
* date/time value is the same as that of the receiver, and which uses
|
||||||
|
@ -1203,15 +1209,9 @@ otherTime(NSDate* other)
|
||||||
return [s autorelease];
|
return [s autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an autoreleased NSDate instance whose value if offset from
|
|
||||||
* that of the receiver by seconds.
|
|
||||||
*/
|
|
||||||
- (id) addTimeInterval: (NSTimeInterval)seconds
|
- (id) addTimeInterval: (NSTimeInterval)seconds
|
||||||
{
|
{
|
||||||
/* xxx We need to check for overflow? */
|
return [self dateByAddingTimeInterval: seconds];
|
||||||
return [[self class] dateWithTimeIntervalSinceReferenceDate:
|
|
||||||
otherTime(self) + seconds];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -105,7 +105,19 @@ static NSDate *theFuture = nil;
|
||||||
|
|
||||||
- (void) fire
|
- (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
|
- (id) initWithSelector: (SEL)aSelector
|
||||||
|
|
Loading…
Reference in a new issue