4 Copyright (C) 1995, 1996 Ovidiu Predescu and Mircea Oancea.
7 Author: Mircea Oancea <mircea@jupiter.elcom.pub.ro>
9 This file is part of libFoundation.
11 Permission to use, copy, modify, and distribute this software and its
12 documentation for any purpose and without fee is hereby granted, provided
13 that the above copyright notice appear in all copies and that both that
14 copyright notice and this permission notice appear in supporting
17 We disclaim all warranties with regard to this software, including all
18 implied warranties of merchantability and fitness, in no event shall
19 we be liable for any special, indirect or consequential damages or any
20 damages whatsoever resulting from loss of use, data or profits, whether in
21 an action of contract, negligence or other tortious action, arising out of
22 or in connection with the use or performance of this software.
25 #include <Foundation/common.h>
26 #include <Foundation/NSString.h>
27 #include <Foundation/NSException.h>
29 #include "NSConcreteDate.h"
31 @implementation NSConcreteDate
33 - initWithTimeIntervalSinceReferenceDate:(NSTimeInterval)secsToBeAdded
36 timeSinceRef = secsToBeAdded;
43 timeSinceRef = [NSDate timeIntervalSinceReferenceDate];
47 - (id)copyWithZone:(NSZone *)zone
49 if ([self zone] == zone)
51 return [[[self class] allocWithZone:zone]
52 initWithTimeIntervalSinceReferenceDate:timeSinceRef];
55 - (NSTimeInterval)timeIntervalSinceReferenceDate
60 - (void)setTimeIntervalSinceReferenceDate:(NSTimeInterval)secsToBeAdded
62 timeSinceRef = secsToBeAdded;
65 - (NSComparisonResult)compare:(NSDate*)other
67 if ([other isKindOfClass:[NSDate class]]) {
69 = timeSinceRef - [other timeIntervalSinceReferenceDate];
73 : (diff == 0 ? NSOrderedSame : NSOrderedDescending));
76 NSAssert(0, @"Cannot compare NSDate with %@", [other class]);