Re: NSCalendar date calculation anomaly
Re: NSCalendar date calculation anomaly
- Subject: Re: NSCalendar date calculation anomaly
- From: Scott Ribe <email@hidden>
- Date: Tue, 27 Apr 2010 22:18:57 -0600
Digging under the covers:
CFGregorianUnits gu = { 0, 0, numdays, 0, 0, 0 };
CFAbsoluteTime at = CFAbsoluteTimeAddGregorianUnits( 0, NULL, gu );
cd = [NSDate dateWithTimeIntervalSinceReferenceDate: at];
NSLog( @"date 4: %@", [cd description] );
Produces: "date 4: 2010-05-04 18:00:00 -0600", which is at least the right moment in time, even though it is not displayed correctly.
While trying to use the time zone explicitly:
CFGregorianUnits gu = { 0, 0, numdays, 0, 0, 0 };
CFAbsoluteTime at = CFAbsoluteTimeAddGregorianUnits( 0, CFTimeZoneCopySystem(), gu );
cd = [NSDate dateWithTimeIntervalSinceReferenceDate: at];
NSLog( @"date 4: %@", [cd description] );
Produces: "date 4: 2010-05-04 17:00:00 -0600", which is wronger ;-)
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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