diff --git a/ChangeLog b/ChangeLog index 4964df6e1..b01bab098 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-10-15 Fred Kiefer + + * Headers/Foundation/NSDate.h, + * Source/NSDate.m: + Add 10.6 class method dateWithTimeInterval:sinceDate: + Patch by Marcian Lytwyn + 2013-10-04 Richard Frith-Macdonald * Source/NSTimeZone.m: Fix bug with byte swapping ... use NSByteOrder.h diff --git a/Headers/Foundation/NSDate.h b/Headers/Foundation/NSDate.h index 2172f1ba4..0ac3c1f10 100644 --- a/Headers/Foundation/NSDate.h +++ b/Headers/Foundation/NSDate.h @@ -112,6 +112,7 @@ GS_EXPORT const NSTimeInterval NSTimeIntervalSince1970; * that of the receiver by the specified interval. */ - (id) dateByAddingTimeInterval: (NSTimeInterval)ti; ++ (id) dateWithTimeInterval: (NSTimeInterval)seconds sinceDate: (NSDate*)date; #endif #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) diff --git a/Source/NSDate.m b/Source/NSDate.m index 080c25c97..597c9d31c 100644 --- a/Source/NSDate.m +++ b/Source/NSDate.m @@ -974,6 +974,15 @@ otherTime(NSDate* other) seconds]); } +/** + * Returns an autoreleased instance with the offset from the given date. + */ ++ (id) dateWithTimeInterval: (NSTimeInterval)seconds sinceDate: (NSDate*)date +{ + return AUTORELEASE([[self alloc] initWithTimeInterval: seconds + sinceDate: date]); +} + /** * Returns an autoreleased instance with th date/time set in the far * future.