Re: Need localization-proof method of transporting dates.
Re: Need localization-proof method of transporting dates.
- Subject: Re: Need localization-proof method of transporting dates.
- From: Graham Cox <email@hidden>
- Date: Wed, 8 Apr 2009 14:11:36 +1000
On 08/04/2009, at 1:54 PM, Michael Ash wrote:
If this is also how you store your dates then this is fine. If you
store them in some other way (e.g. asking the system to put them in an
plist) then this is still fine as long as you're using whole numbers
of seconds. If you can store arbitrary fractional values of seconds in
your dates, and you store them in some other way than the above, then
I would be wary: floating point math is inexact, and it's possible
that the conversion to and from the intermediate representation could
end up with a different least-significant bit.
Note that if you manually convert your date to the serialized
representation but it's not the above, then you could simply hash that
intermediate representation directly.
Well, the date itself is stored in the archive using standard
archiving. I'm not sure how it writes itself - so should I be worried?
I thought I could rely on archiving/dearchiving accurately giving me
back whatever I stored though in this case there could be a tiny change.
The date comes from a NSDatePicker control, which is set to have 1
minute resolution (which is still more than I need, 1 day res would be
fine, haven't looked into whether there's a way to lose the time part
in the control). I can certainly pre-process the received date to
truncate it to a whole minute or even a whole day. I should probably
do this to make sure.
--Graham
_______________________________________________
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