On Thu, 12 Jun 2003, Rick Measham wrote: > I can understand why we look like we need all this stuff for milli-, > micro- and nano-seconds, but it is exactly what I was scared of when > we were talking about sub-second support. Nano-, Milli- and Micro- > seconds are not different things like hours an minutes are, they're > just fractional seconds. We really should have just left it as > floating seconds, or as fractional seconds rather than settling on > some arbitrary precision like nanoseconds.
Floating point as a default is bad, since it's imprecise. Nuff said on that. > You can represent time with accessors like: ->hour:->minute:->second, > but accessors like micro- and milli- are ambiguous. They look like > the other accessors so can you just 'whack them on'? > > $dt->hour . ':' . $ct->minute . ':' . $st->second . '.' . > $dt->millisecond . $dt->microsecond . $dt->nanosecond People who need sub-second precision _will_ understand the difference, or else they are not qualified to be doing whatever job/project they're doing that requires sub-second precision! > We really should have just left it as ->second and > ->fractional_second and probably ->floating_second($precision) > (returning floating, not fractional seconds). We especially don't > need them in the constructor. It's confusing now: See above. > $dt = DateTime->new(%date, second=>12, nanosecond=>345) > > Is that 12.345 seconds? Nup. It's 12.000000345 (I think). > > $dt = DateTime->new(%date, second=>12, fractional_second=>345) > > Is that 12.345 seconds? Nup. It's 357 seconds! But this I agree with. I was pretty skeptical of the "fractional_second" constructor parameter, and I've been thinking of removing it for a while. I don't want to make things harder than they need to be, but this parameter is confusing. > Imagine extra constructors, it feels good at first: > > $dt = DateTime->new( > year=>2003, > month=>6, > day=>12, > hour=>7, > minute=>22, > second=>12, > millisecond=>345, > microsecond=>678, > nanosecond=>901 > ); Doesn't feel good to me, that's why I vetoed it ;) > Of course you could have extra accessors for ->just_nanoseconods > (returns 901), ->just_microseconds and ->just_milliseconds, but it's > all a little silly. Can't we can the nanosecond and just talk about > seconds (and fractional seconds)? No, if anything, we'll can the fractional_second constructor parameter. Nanoseconds are here to stay, because I don't want to add "bigfloat" to the mix, and I want us to be accurate. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/