On Thu, 19 Feb 2009, Darren Duncan wrote:

And which is why subsecond and whole-second *can* be combined. Appropriate separation allows better accuracy in letting people express what they mean rather than shoehorning it into a less accurate space, like DateTime.pm shoehorns into Days+Seconds+Nanoseconds.

Not to get too off-topic, but this is just incorrect. The way DateTime.pm handles this _internally_ is to store days since an epoch, and seconds into the day (and nanoseconds).

Ignoring the precision lost by using nanoseconds, this storage format is otherwise perfectly precise. While the number of seconds per minute, hour, or day varies, we can _calculate_ the hour & minute from that value. Similarly, we can _calculate_ the year, month, & day with perfect accuracy.

It's not necessary to store each unit internally in order to get everything right, and not doing so makes some things a lot easier (though it makes other things harder ;)


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/

Reply via email to