mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
([NSDate +distantFuture]): Increase efficiency by caching a single
instance in a static variable. ([NSDate +distantPast]): Likewise. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1184 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3627f4f3e1
commit
6b8ba601bc
1 changed files with 8 additions and 2 deletions
|
@ -164,12 +164,18 @@
|
||||||
|
|
||||||
+ (NSDate*) distantFuture
|
+ (NSDate*) distantFuture
|
||||||
{
|
{
|
||||||
return [self dateWithTimeIntervalSinceReferenceDate: DISTANT_FUTURE];
|
static id df = nil;
|
||||||
|
if (!df)
|
||||||
|
df = [[self alloc] initWithTimeIntervalSinceReferenceDate: DISTANT_FUTURE];
|
||||||
|
return df;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSDate*) distantPast
|
+ (NSDate*) distantPast
|
||||||
{
|
{
|
||||||
return [self dateWithTimeIntervalSinceReferenceDate: DISTANT_PAST];
|
static id dp = nil;
|
||||||
|
if (!dp)
|
||||||
|
dp = [[self alloc] initWithTimeIntervalSinceReferenceDate: DISTANT_PAST];
|
||||||
|
return dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) init
|
- (id) init
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue