On 3/26/03 12:33 AM, Dave Rolsky wrote:
> On Tue, 25 Mar 2003, John Siracusa wrote:
>> Hrm, well, I'd actually be happy (for my purposes) with simply storing
>> fractional seconds as an integer somewhere.  I don't care if fractional
>> durations are allowed, or if fractional seconds are used in date
>> calculations at all.  I just want fractional seconds to be preserved:
> 
> See, some people think it should be another attribute, other think that
> seconds should be floating point.  Personally, I don't know.

If you mean that seconds should be stored as an actual float, I think that's
obviously the wrong choice due to rounding errors during floating point
math.  Better to actually store the numbers before and after the decimal
point as separate integers (or use a single "BigFloat"-type value that
avoids rounding errors).  But that's just the storage method.  Making a
float_seconds attribute that join('.', ...)s them is fine, whatever :)

> But if it's another attribute it needs a precision.  I don't want to call
> it "fractional seconds" and let each user decide, because that kills
> inter-operability.

Fractional seconds can simply be the most general form of the attribute.
You can then truncate/pad (or round) that value to produce all
fixed-precision "derived" attributes: milliseconds, nanoseconds, etc.  But
"fractional seconds" should simply be an integer (or BigInt, if necessary)
value that comes after the decimal point.  That's the most general
implementation, and doesn't close any doors for the future, as far as I can
tell.  You may also think it's the most "useless" implementation, but it'd
help me, at least :)

I've already got at least two different precisions for fractional seconds,
and I'm perfectly happy to sprintf() or round() for myself as necessary to
help interoperability while I wait for further standardization.  I just need
a place to store fractional seconds.

-John

Reply via email to