1 /* Interface for NSTimeZone for GNUStep
2    Copyright (C) 1994, 1996, 1999 Free Software Foundation, Inc.
3 
4    This file is part of the GNUstep Base Library.
5 
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2 of the License, or (at your option) any later version.
10 
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15 
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free
18    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19    Boston, MA 02110 USA.
20   */
21 
22 #ifndef __NSTimeZone_h_GNUSTEP_BASE_INCLUDE
23 #define __NSTimeZone_h_GNUSTEP_BASE_INCLUDE
24 #import	<GNUstepBase/GSVersionMacros.h>
25 
26 #import	<Foundation/NSObject.h>
27 
28 #if	defined(__cplusplus)
29 extern "C" {
30 #endif
31 
32 @class	NSArray;
33 @class	NSDate;
34 @class	NSDictionary;
35 @class  NSLocale;
36 @class	NSString;
37 
38 #if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST)
39 enum {
40   NSTimeZoneNameStyleStandard,
41   NSTimeZoneNameStyleShortStandard,
42   NSTimeZoneNameStyleDaylightSaving,
43   NSTimeZoneNameStyleShortDaylightSaving
44 };
45 typedef NSInteger NSTimeZoneNameStyle;
46 GS_EXPORT NSString * const NSSystemTimeZoneDidChangeNotification;
47 #endif
48 
49 @interface NSTimeZone : NSObject
50 
51 //Creating and Initializing an NSTimeZone
52 + (NSTimeZone*) localTimeZone;
53 + (NSTimeZone*) timeZoneForSecondsFromGMT: (NSInteger)seconds;
54 + (NSTimeZone*) timeZoneWithName: (NSString*)aTimeZoneName;
55 
56 //Managing Time Zones
57 + (void) setDefaultTimeZone: (NSTimeZone*)aTimeZone;
58 
59 // Getting Time Zone Information
60 + (NSDictionary*) abbreviationDictionary;
61 + (NSArray*) knownTimeZoneNames;
62 
63 //Getting Arrays of Time Zones
64 + (NSArray*) timeZoneArray;
65 - (NSArray*) timeZoneDetailArray;
66 
67 #if	OS_API_VERSION(GS_API_NONE, GS_API_LATEST)
68 /* Returns an dictionary that maps abbreviations to the array
69    containing all the time zone names that use the abbreviation. */
70 + (NSDictionary*) abbreviationMap;
71 #endif
72 
73 #if	OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
74 + (void) resetSystemTimeZone;
75 + (NSTimeZone*) systemTimeZone;
76 + (NSTimeZone*) timeZoneWithName: (NSString*)name data: (NSData*)data;
77 - (NSString*) abbreviation;
78 - (NSString*) abbreviationForDate: (NSDate*)aDate;
79 - (NSData*) data;
80 - (id) initWithName: (NSString*)name;
81 - (id) initWithName: (NSString*)name data: (NSData*)data;
82 - (BOOL) isDaylightSavingTime;
83 - (BOOL) isDaylightSavingTimeForDate: (NSDate*)aDate;
84 - (BOOL) isEqualToTimeZone: (NSTimeZone*)aTimeZone;
85 - (NSString*) name;
86 - (NSInteger) secondsFromGMT;
87 - (NSInteger) secondsFromGMTForDate: (NSDate*)aDate;
88 #endif
89 
90 #if OS_API_VERSION(MAC_OS_X_VERSION_10_5,GS_API_LATEST)
91 - (NSTimeInterval) daylightSavingTimeOffsetForDate: (NSDate *)aDate;
92 /** Not implemented */
93 - (NSDate *) nextDaylightSavingTimeTransitionAfterDate: (NSDate *)aDate;
94 
95 - (NSTimeInterval) daylightSavingTimeOffset;
96 /** Not implemented */
97 - (NSDate *) nextDaylightSavingTimeTransition;
98 
99 - (NSString *)localizedName: (NSTimeZoneNameStyle)style
100                      locale: (NSLocale *)locale;
101 #endif
102 
103 #if	OS_API_VERSION(GS_API_OPENSTEP, GS_API_MACOSX)
104 - (NSTimeZoneDetail*) timeZoneDetailForDate: (NSDate*)date;
105 - (NSString*) timeZoneName;
106 #endif
107 
108 /*
109  * The next two methods are a problem ... they are present in both
110  * OpenStep and MacOS-X, but return different types!
111  * We resort to the MaxOS-X version.
112  */
113 + (NSTimeZone*) defaultTimeZone;
114 + (NSTimeZone*) timeZoneWithAbbreviation: (NSString*)abbreviation;
115 
116 @end
117 
118 #if	OS_API_VERSION(GS_API_OPENSTEP, GS_API_MACOSX)
119 @interface NSTimeZoneDetail : NSTimeZone
120 - (BOOL) isDaylightSavingTimeZone;
121 - (NSString*) timeZoneAbbreviation;
122 - (NSInteger) timeZoneSecondsFromGMT;
123 @end
124 #endif
125 
126 #if	defined(__cplusplus)
127 }
128 #endif
129 
130 #endif  /* __NSTimeZone_h_GNUSTEP_BASE_INCLUDE*/
131 
132