Zefram schreef: > I recommend Math::BigRat, which you'll have noticed I'm quite a fan of. > Bignums mean never having to think how big your floats are.
I will take a look. > >I don't understand why you say DT does not know about CJDNs. > > Did you notice that JD refers to Universal Time but CJD is > timezone-relative? That's one of the things that Date::JD makes work > right. Timezone-relative day counts are not implemented by DT; that is true. But have you looked at the DT::Format::Epoch example in my first mail yet? Example: # Parser object $cjd defined as in previous mail my $dt = DateTime->now( time_zone => 'UTC' ); printf "%s %.3f %.3f\n", $dt, $dt->jd, $cjd->format_datetime( $dt ); $dt->set_time_zone( 'America/New_York' ); printf "%s %.3f %.3f\n", $dt, $dt->jd, $cjd->format_datetime( $dt ); Output: Datetime JD CJD ======== == === 2006-07-17T21:06:28 2453934.379 2453934.879 2006-07-17T17:06:28 2453934.379 2453934.713 > In DateTime this issue gets into the floating timezone, which > looks like a right can of worms. I think the floating timezone is trying > to make DateTime do too many things in one class. It's schizophrenic. If you care about leap seconds, just stay far away from the floating timezone. > Looks like another abstraction inversion to me: what's a specific calendar > doing in such a fundamental class? The only reason DateTime.pm (the module) seems to be the fundamental class of DateTime (the project) is the name; it has no central role, although there are a number of modules (e.g. formatting modules) that have been written especially for DT.pm, because it is the most commonly used. > How do you convert between two non-Gregorian calendars using DateTime? Every DT::Calendar module has two required functions: one that returns the RD and the number of elapsed seconds in the day; and one that accepts these values and converts them to a new object. See http://datetime.perl.org/index.cgi?CalendarModules for details. Eugene