commit missed file

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4763 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-08-25 16:15:12 +00:00
parent 6812c6aa5f
commit 388c61dbaa

View file

@ -18,7 +18,7 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/ */
#include <config.h> #include <config.h>
@ -122,7 +122,7 @@
return [self class]; return [self class];
} }
- replacementObjectForPortCoder: aRmc - (id) replacementObjectForPortCoder: (NSPortCoder*)aRmc
{ {
return self; return self;
} }
@ -145,10 +145,13 @@
- (void) dealloc - (void) dealloc
{ {
RELEASE(calendar_format); RELEASE(calendar_format);
RELEASE(time_zone);
[super dealloc]; [super dealloc];
} }
// Initializing an NSCalendar Date /*
* Initializing an NSCalendar Date
*/
- (id) initWithString: (NSString *)description - (id) initWithString: (NSString *)description
{ {
// +++ What is the locale? // +++ What is the locale?
@ -166,11 +169,11 @@
locale: nil]; locale: nil];
} }
// /*
// This function could possibly be written better * This function could possibly be written better
// but it works ok; currently ignores locale * but it works ok; currently ignores locale
// information and some specifiers. * information and some specifiers.
// */
- (id) initWithString: (NSString *)description - (id) initWithString: (NSString *)description
calendarFormat: (NSString *)format calendarFormat: (NSString *)format
locale: (NSDictionary *)locale locale: (NSDictionary *)locale
@ -487,9 +490,9 @@
s += second; s += second;
// Assign time zone detail // Assign time zone detail
time_zone = [aTimeZone time_zone = RETAIN([aTimeZone
timeZoneDetailForDate: timeZoneDetailForDate:
[NSDate dateWithTimeIntervalSinceReferenceDate: s]]; [NSDate dateWithTimeIntervalSinceReferenceDate: s]]);
// Adjust date so it is correct for time zone. // Adjust date so it is correct for time zone.
s -= [time_zone timeZoneSecondsFromGMT]; s -= [time_zone timeZoneSecondsFromGMT];
@ -519,7 +522,7 @@
NSTimeInterval newOffset; NSTimeInterval newOffset;
oldOffset = [time_zone timeZoneSecondsFromGMT]; oldOffset = [time_zone timeZoneSecondsFromGMT];
time_zone = z; ASSIGN(time_zone, z);
newOffset = [time_zone timeZoneSecondsFromGMT]; newOffset = [time_zone timeZoneSecondsFromGMT];
s += newOffset - oldOffset; s += newOffset - oldOffset;
} }
@ -563,13 +566,18 @@
if (!calendar_format) if (!calendar_format)
calendar_format = @"%Y-%m-%d %H:%M:%S %z"; calendar_format = @"%Y-%m-%d %H:%M:%S %z";
if (!time_zone) if (!time_zone)
time_zone = [[NSTimeZone localTimeZone] timeZoneDetailForDate: self]; time_zone = RETAIN([[NSTimeZone localTimeZone]
timeZoneDetailForDate: self]);
return self; return self;
} }
// Retreiving Date Elements // Retreiving Date Elements
- (void)getYear: (int *)year month: (int *)month day: (int *)day - (void) getYear: (int *)year
hour: (int *)hour minute: (int *)minute second: (int *)second month: (int *)month
day: (int *)day
hour: (int *)hour
minute: (int *)minute
second: (int *)second
{ {
int h, m; int h, m;
double a, b, c, d = [self dayOfCommonEra]; double a, b, c, d = [self dayOfCommonEra];
@ -743,14 +751,12 @@
// Getting String Descriptions of Dates // Getting String Descriptions of Dates
- (NSString*) description - (NSString*) description
{ {
return [self descriptionWithCalendarFormat: calendar_format return [self descriptionWithCalendarFormat: calendar_format locale: nil];
locale: nil];
} }
- (NSString*) descriptionWithCalendarFormat: (NSString *)format - (NSString*) descriptionWithCalendarFormat: (NSString *)format
{ {
return [self descriptionWithCalendarFormat: format return [self descriptionWithCalendarFormat: format locale: nil];
locale: nil];
} }
#define UNIX_REFERENCE_INTERVAL -978307200.0 #define UNIX_REFERENCE_INTERVAL -978307200.0
@ -1035,6 +1041,7 @@
if (newDate) if (newDate)
{ {
newDate->calendar_format = [calendar_format copyWithZone: zone]; newDate->calendar_format = [calendar_format copyWithZone: zone];
newDate->time_zone = RETAIN(time_zone);
} }
} }
return newDate; return newDate;
@ -1042,8 +1049,7 @@
- (NSString*) descriptionWithLocale: (NSDictionary *)locale - (NSString*) descriptionWithLocale: (NSDictionary *)locale
{ {
return [self descriptionWithCalendarFormat: calendar_format return [self descriptionWithCalendarFormat: calendar_format locale: locale];
locale: locale];
} }
// Getting and Setting Calendar Formats // Getting and Setting Calendar Formats
@ -1061,7 +1067,9 @@
// Getting and Setting Time Zones // Getting and Setting Time Zones
- (void) setTimeZone: (NSTimeZone *)aTimeZone - (void) setTimeZone: (NSTimeZone *)aTimeZone
{ {
time_zone = [aTimeZone timeZoneDetailForDate: self]; NSTimeZoneDetail *detail = [aTimeZone timeZoneDetailForDate: self];
ASSIGN(time_zone, detail);
} }
- (NSTimeZoneDetail*) timeZoneDetail - (NSTimeZoneDetail*) timeZoneDetail