1995-03-31 15:39:12 +00:00
|
|
|
/* Interface for NSDate for GNUStep
|
1999-09-16 07:21:34 +00:00
|
|
|
Copyright (C) 1994, 1996, 1999 Free Software Foundation, Inc.
|
1995-03-31 15:39:12 +00:00
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
1995-03-31 15:39:12 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-09-14 11:36:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
1995-03-31 15:39:12 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-08 10:38:33 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
1995-03-31 15:39:12 +00:00
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
2007-09-14 11:36:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
1995-03-31 15:39:12 +00:00
|
|
|
License along with this library; if not, write to the Free
|
2006-10-31 07:05:46 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
1999-09-16 07:21:34 +00:00
|
|
|
*/
|
1995-03-31 15:39:12 +00:00
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#ifndef __NSDate_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSDate_h_GNUSTEP_BASE_INCLUDE
|
2006-10-31 07:05:46 +00:00
|
|
|
#import <GNUstepBase/GSVersionMacros.h>
|
1995-03-31 15:39:12 +00:00
|
|
|
|
2006-10-31 07:05:46 +00:00
|
|
|
#import <Foundation/NSObjCRuntime.h>
|
2002-11-01 08:11:46 +00:00
|
|
|
|
2006-09-13 10:20:49 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2002-11-01 08:11:46 +00:00
|
|
|
/**
|
|
|
|
* Time interval difference between two dates, in seconds.
|
|
|
|
*/
|
1996-03-12 14:43:55 +00:00
|
|
|
typedef double NSTimeInterval;
|
1995-03-31 15:39:12 +00:00
|
|
|
|
2002-11-01 08:11:46 +00:00
|
|
|
/**
|
|
|
|
* Time interval between the unix standard reference date of 1 January 1970
|
|
|
|
* and the OpenStep reference date of 1 January 2001<br />
|
|
|
|
* This number comes from:<br />
|
|
|
|
* (((31 years * 365 days) + 8 days for leap years) = total number of days<br />
|
|
|
|
* 24 hours * 60 minutes * 60 seconds)<br />
|
|
|
|
* This ignores leap-seconds.
|
|
|
|
*/
|
|
|
|
GS_EXPORT const NSTimeInterval NSTimeIntervalSince1970;
|
|
|
|
|
2006-10-31 07:05:46 +00:00
|
|
|
#import <Foundation/NSObject.h>
|
1998-04-02 14:27:40 +00:00
|
|
|
|
1995-08-23 15:19:46 +00:00
|
|
|
@class NSArray;
|
1995-03-31 15:39:12 +00:00
|
|
|
@class NSCalendarDate;
|
2001-01-30 20:47:05 +00:00
|
|
|
@class NSData;
|
1995-08-23 15:19:46 +00:00
|
|
|
@class NSDictionary;
|
1995-03-31 15:39:12 +00:00
|
|
|
@class NSString;
|
|
|
|
@class NSTimeZone;
|
1995-08-23 15:19:46 +00:00
|
|
|
@class NSTimeZoneDetail;
|
1995-03-31 15:39:12 +00:00
|
|
|
|
1997-09-01 21:59:51 +00:00
|
|
|
@interface NSDate : NSObject <NSCoding,NSCopying>
|
1996-10-31 17:14:00 +00:00
|
|
|
{
|
|
|
|
}
|
1995-03-31 15:39:12 +00:00
|
|
|
|
|
|
|
// Getting current time
|
|
|
|
|
|
|
|
+ (NSTimeInterval) timeIntervalSinceReferenceDate;
|
|
|
|
|
|
|
|
// Allocation and initializing
|
|
|
|
|
1998-01-21 14:56:24 +00:00
|
|
|
+ (id) date;
|
|
|
|
+ (id) dateWithString: (NSString*)description;
|
|
|
|
+ (id) dateWithTimeIntervalSinceNow: (NSTimeInterval)seconds;
|
|
|
|
+ (id) dateWithTimeIntervalSince1970: (NSTimeInterval)seconds;
|
|
|
|
+ (id) dateWithTimeIntervalSinceReferenceDate: (NSTimeInterval)seconds;
|
|
|
|
+ (id) distantFuture;
|
|
|
|
+ (id) distantPast;
|
1996-10-31 17:14:00 +00:00
|
|
|
|
1995-04-13 22:13:59 +00:00
|
|
|
- (id) initWithString: (NSString*)description;
|
1998-01-21 14:56:24 +00:00
|
|
|
- (id) initWithTimeInterval: (NSTimeInterval)secsToBeAdded
|
|
|
|
sinceDate: (NSDate*)anotherDate;
|
|
|
|
- (id) initWithTimeIntervalSinceNow: (NSTimeInterval)secsToBeAdded;
|
1995-04-13 22:13:59 +00:00
|
|
|
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs;
|
1995-03-31 15:39:12 +00:00
|
|
|
|
|
|
|
// Converting to NSCalendar
|
|
|
|
|
1999-09-16 07:21:34 +00:00
|
|
|
- (NSCalendarDate*) dateWithCalendarFormat: (NSString*)formatString
|
|
|
|
timeZone: (NSTimeZone*)timeZone;
|
1995-03-31 15:39:12 +00:00
|
|
|
|
|
|
|
// Representing dates
|
|
|
|
|
|
|
|
- (NSString*) description;
|
1995-04-13 22:13:59 +00:00
|
|
|
- (NSString*) descriptionWithCalendarFormat: (NSString*)format
|
1998-11-30 10:04:24 +00:00
|
|
|
timeZone: (NSTimeZone*)aTimeZone
|
2001-12-17 14:31:42 +00:00
|
|
|
locale: (NSDictionary*)l;
|
1999-09-16 07:21:34 +00:00
|
|
|
- (NSString*) descriptionWithLocale: (NSDictionary*)locale;
|
1995-03-31 15:39:12 +00:00
|
|
|
|
|
|
|
// Adding and getting intervals
|
|
|
|
|
1998-01-21 14:56:24 +00:00
|
|
|
- (id) addTimeInterval: (NSTimeInterval)seconds;
|
1997-03-03 20:07:35 +00:00
|
|
|
- (NSTimeInterval) timeIntervalSince1970;
|
1995-04-13 22:13:59 +00:00
|
|
|
- (NSTimeInterval) timeIntervalSinceDate: (NSDate*)otherDate;
|
1995-03-31 15:39:12 +00:00
|
|
|
- (NSTimeInterval) timeIntervalSinceNow;
|
|
|
|
- (NSTimeInterval) timeIntervalSinceReferenceDate;
|
1998-11-30 10:04:24 +00:00
|
|
|
- (NSTimeInterval) timeIntervalSinceReferenceDate;
|
1995-03-31 15:39:12 +00:00
|
|
|
|
|
|
|
// Comparing dates
|
|
|
|
|
1995-04-13 22:13:59 +00:00
|
|
|
- (NSComparisonResult) compare: (NSDate*)otherDate;
|
|
|
|
- (NSDate*) earlierDate: (NSDate*)otherDate;
|
2001-12-17 14:31:42 +00:00
|
|
|
- (BOOL) isEqualToDate: (NSDate*)other;
|
1995-04-13 22:13:59 +00:00
|
|
|
- (NSDate*) laterDate: (NSDate*)otherDate;
|
1995-03-31 15:39:12 +00:00
|
|
|
|
2006-10-31 07:05:46 +00:00
|
|
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
1999-09-16 07:21:34 +00:00
|
|
|
+ (id) dateWithNaturalLanguageString: (NSString*)string;
|
|
|
|
+ (id) dateWithNaturalLanguageString: (NSString*)string
|
2001-12-17 14:31:42 +00:00
|
|
|
locale: (NSDictionary*)locale;
|
1998-12-18 17:05:44 +00:00
|
|
|
- (id) initWithTimeIntervalSince1970: (NSTimeInterval)seconds;
|
|
|
|
#endif
|
|
|
|
|
1995-03-31 15:39:12 +00:00
|
|
|
@end
|
|
|
|
|
2006-09-13 10:20:49 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-09-16 07:21:34 +00:00
|
|
|
#endif /* __NSDate_h_GNUSTEP_BASE_INCLUDE*/
|