Re: NSCalendarDate, NSTimer - Daylight Saving Time (DST) problem is tricky...
Re: NSCalendarDate, NSTimer - Daylight Saving Time (DST) problem is tricky...
- Subject: Re: NSCalendarDate, NSTimer - Daylight Saving Time (DST) problem is tricky...
- From: Simon Liu <email@hidden>
- Date: Wed, 6 Apr 2005 17:58:12 +0100
> IIRC, the time change notification is undocumented and you need to use
> Carbon, but my code is at home and I'm at work...
Do you mean AppleTimePreferencesChangedNotification ?
http://www.cocoabuilder.com/archive/message/cocoa/2004/9/28/118450
> >Say you have a timer set to fire at 01:30:00, since it happens twice,
> >when should it fire? From some investigation, it seems that with
> >NSCalendarDate, 01:30:00 only occurs once, so what happened to the
> >second occurence?
>
> NSCalendarDate also has a time zone component, so it should be able to
> represent both 01:30s.
You're sort of right in that you can 'represent' the 01:30, but only
in timeInterval form.
The NSCalendarDate docs for +dateWithYear:... state the second 01:30
can't be created:
"On days when daylight savings "falls back," there are two 1:30 AMs.
If you use this method there is no way to create the second 1:30 AM.
Instead, you should create the first and then use
dateByAddingYears:months:days:hours:minutes:seconds: to add an hour."
152321400 --- 30 Oct 05, 01:30:00 Europe/Brussels --- isDST=1, TZID=CEST
152325000 --- 30 Oct 05, 02:30:00 Europe/Brussels --- isDST=1, TZID=CEST ***
152326800 --- 30 Oct 05, 02:00:00 Europe/Brussels --- isDST=0, TZID=CET
I think what NSCalendarDate does is simply add on the timeInterval,
but it doesn't correct the hours, minutes, or second values for the
"fall back".
The docs say "if you use this method...", which sort of implies that
there is another method which might be able to create the second 01:30
correctly. I don't know what it is.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden