Re: NSDate without time portion
Re: NSDate without time portion
- Subject: Re: NSDate without time portion
- From: Quincey Morris <email@hidden>
- Date: Tue, 5 Jan 2010 13:02:57 -0800
On Jan 5, 2010, at 12:33, Nick Zitzmann wrote:
> On Jan 5, 2010, at 1:23 PM, Quincey Morris wrote:
>
>> Firstly, you can't *in general* normalize to a specific time, because you can't in general know that the time exists on every date.
>
> Unless you use a specific time zone, and store that time zone information elsewhere in the model. And if you use GMT, as I mentioned earlier, unless some cosmic event happens that disturbs the flow of time, there is no such thing as a GMT time that does not exist, since GMT ignores transforms like daylight savings.
I'll say this part again, and keep saying it till someone actually tells me I'm wrong:
...
Wait, no, I did that already.
Assuming that you're going to ultimately present the user with dates in the user interface, it's still a cultural assumption that the dates as the user perceives them map directly onto UTC date/times. Yes, I know I'm standing up for cultural perspectives that likely don't exist, but I think it's important to make the point that dates vs date/times is a subtle matter.
The OP wanted to use NSDate objects to avoid the clunkiness of multiple values/variables with NSDateComponents. I'm arguing that avoiding NSDateComponents is a *lot* more work, and that using NSDate for this purpose is *very* easy to get wrong.
As to the cosmic event -- well, I already mentioned leap seconds. Depending on which way the leap goes, there *will* be a UTC time that doesn't exist, or one that exists twice*. :)
*I think -- I don't really know enough about it.
_______________________________________________
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