#import <foundation/NSDate.h>
#import "MiscClockView_Foundation.h"

@implementation MiscClockView(NSCalendarDate)

- (void) setCalendarDate:(NSCalendarDate*) aDate
{
	seconds = [aDate secondOfMinute];
	minutes = [aDate minuteOfHour];
	hours = [aDate hourOfDay];
	date = [aDate dayOfMonth];
	month = [aDate monthOfYear]-1;
	year = [aDate yearOfCommonEra]-1900;
	weekday = [aDate dayOfWeek];
}

- (NSCalendarDate*) calendarDate
{
	NSCalendarDate *calendarDate;
	
	calendarDate = [NSCalendarDate dateWithYear:year+1900
		month:month+1 
		day:date 
		hour:hours 
		minute:minutes 
		second:seconds 
		timeZone:[NSTimeZone localTimeZone]];

	return calendarDate;
}

@end
