How to implement a Joda DateTime and Duration with fraction milliseconds

74 Views Asked by At

I have a requirement to implement a DateTime and Duration object that keeps track of its value using a fractional value. For all intents and purposes, these types should be equivalent to the Joda's DateTime and Duration types, except the millis not 'long'.

How would I go about implementing these types so they are consistent and I get to keep all the niceties Joda brings with it? Is it even possible?

EDIT: To remove ambiguity, by "fractional value", I mean actual fractions, i.e. rational numbers.

1

There are 1 best solutions below

3
Louis Wasserman On

You probably can't get all of the "niceties Joda brings with it."

What you could do -- which Joda might or might not play well with -- is use java.time.Duration, which has nanosecond precision, which is good enough for any application I can conceive of.