• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSCalendar dateByAddingComponents: yields inconsistent results
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSCalendar dateByAddingComponents: yields inconsistent results
      • From: Jim Thomason <email@hidden>
References: 
 >NSCalendar dateByAddingComponents: yields inconsistent results (From: Jim Thomason <email@hidden>)

  • Prev by Date: Re: inter-process locks
  • Next by Date: Re: inter-process locks
  • Previous by thread: NSCalendar dateByAddingComponents: yields inconsistent results
  • Next by thread: Re: NSCalendar dateByAddingComponents: yields inconsistent results
  • Index(es):
    • Date
    • Thread