Re: NSCalendar dateByAddingComponents: yields inconsistent results
Re: NSCalendar dateByAddingComponents: yields inconsistent results
- Subject: Re: NSCalendar dateByAddingComponents: yields inconsistent results
- From: "Stephen J. Butler" <email@hidden>
- Date: Sat, 19 Feb 2011 13:28:03 -0600
On Sat, Feb 19, 2011 at 1:16 PM, Jim Thomason <email@hidden> wrote:
> static NSCalendar* gmtCalendar = nil;
> -(NSCalendar*) gmtCalendar {
> @synchronized(self) {
> if (gmtCalendar == nil) {
> NSLog(@"NEEDS NEW GMT!");
> NSCalendar* newGMTCalendar = [[NSCalendar alloc]
> initWithCalendarIdentifier:NSGregorianCalendar];
> [newGMTCalendar setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
> gmtCalendar = newGMTCalendar;
> }
> }
> return gmtCalendar;
> }
Is this method called from different threads? NSCalendar is
thread-unsafe (not to be shared across threads):
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden