• 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: NSDate and Date formatters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDate and Date formatters


  • Subject: Re: NSDate and Date formatters
  • From: Adrian Bool <email@hidden>
  • Date: Wed, 14 Jan 2004 13:07:21 +0100

Hi Daniel,

On 14 Jan 2004, at 12:36, Daniel Todd Currie wrote:
What time zone are you in (what time zone does your computer think you're in)?

Suspiciously, both myself and my computer are on CET, +1 GMT....

I am in US PST, which is GMT -8. [NSDate dateWithTimeIntervalSinceReferenceDate:0] returns 2000-12-31 16:00 for me, which is exactly what it should be, since the reference date is based on GMT. Remember we are working with dates, not time intervals.

Perhaps I simply don't have all the details, but what do you need this counter for anyway? The system clock is a perfectly good timer... I would think an easier way to do this would be to init an NSDate where you init the counter, and then you can get your counter value with:
[[NSDate date] timeIntervalSinceDate:initDate]

All the program is a Minesweeper clone for me to learn Cocoa! I want to pause the increment of 'seconds' when the window is hidden. Your code suggestion above would not fit with that goal very well.

This would eschew all the confusion over reference dates and worries about your user's time zone.

Just my 2 cents anyway...

Well, you were completely right! I changed my timezone to PST and can see a new different value in my counter. MMm. will need to think what to do next. Thanks for the help.

Regards,

aid
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSDate and Date formatters
      • From: "Louis C. Sacha" <email@hidden>
References: 
 >NSDate and Date formatters (From: Adrian Bool <email@hidden>)
 >Re: NSDate and Date formatters (From: Daniel Todd Currie <email@hidden>)

  • Prev by Date: index of line wrap
  • Next by Date: NSAutoreleasePool
  • Previous by thread: Re: NSDate and Date formatters
  • Next by thread: Re: NSDate and Date formatters
  • Index(es):
    • Date
    • Thread