NSTime Zone Challenge


#1

Hi,
Below is my solution to the Challenge for DayLight Savings Time.
If I use the class method of systemTimeZone it’s telling me (I think) that I am on Daylight savings time.
However, If I use an instance method for isDaylightSavingTime I am getting a 0 returned.
Help?

Thanks

nacht

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];





NSTimeZone *zone = [[NSTimeZone alloc] init];  // Create an instance

NSTimeZone *c = [NSTimeZone systemTimeZone];  //  Class method so don't need to create an instance

NSLog(@"Time zone is %@\n", c);

BOOL z =[zone isDaylightSavingTime];

NSLog(@"Is it set to Daylight Savings time: %d\n", z);


[pool drain];
return 0;

}


#2

I think I see my problem. NSTimeZone doesn’t have an init method. If I use the systemTimeZone class method everything works fine.