mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +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
c00ba6acd1
commit
a6e5beda0e
1 changed files with 8 additions and 2 deletions
|
@ -164,12 +164,18 @@
|
|||
|
||||
+ (NSDate*) distantFuture
|
||||
{
|
||||
return [self dateWithTimeIntervalSinceReferenceDate: DISTANT_FUTURE];
|
||||
static id df = nil;
|
||||
if (!df)
|
||||
df = [[self alloc] initWithTimeIntervalSinceReferenceDate: DISTANT_FUTURE];
|
||||
return df;
|
||||
}
|
||||
|
||||
+ (NSDate*) distantPast
|
||||
{
|
||||
return [self dateWithTimeIntervalSinceReferenceDate: DISTANT_PAST];
|
||||
static id dp = nil;
|
||||
if (!dp)
|
||||
dp = [[self alloc] initWithTimeIntervalSinceReferenceDate: DISTANT_PAST];
|
||||
return dp;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
|
|
Loading…
Reference in a new issue