[threeten-dev] [threeten-develop] Leap seconds and the Java time-scale
Stephen Colebourne
scolebourne at joda.org
Sun Apr 7 03:25:20 PDT 2013
On 5 April 2013 20:59, Douglas Surber <douglas.surber at oracle.com> wrote:
> Given the lack of requirements for a clock it would be useful to add
> some methods that characterize the clock.
I guess that the API you suggest is feasible, but I'm not sure when
users would use it. My feeling is that users won't be iterating around
a list of clocks to find one with particular characteristics, instead
there wil simply be a decision during coding time to chose one.
Stephen
>
> Example:
>
> public enum Monotonicity { UNKNOWN; NONMONOTONIC;
> MONOTONIC_DEPENDENT; MONOTONIC_INDEPENDENT; }
> public Monotonicity getMonotonicity();
> public Duration getPrecision();
>
> MONOTONIC_DEPENDENT means the clock is monotonic so long as some
> other time source external to the JVM (the OS) is monotonic. If the
> sysadmin changes the system clock, time may go backwards.
> MONOTONIC_INDEPENDENT means the clock is monotonic regardless of any
> other time source.
>
> getPrecision returns the least Duration such that the passage of that
> amount of physical time will guarantee that now() returns a different
> value. The returned value is the ideal assuming
> MONOTONIC_INDEPENDENT. If getMonoticity returns some other value then
> the returned precision will be incorrect when the clock is not
> behaving MONOTONIC_INDEPENDENT, such as when the sysadmin is changing
> the system clock.
>
> Just thinking out loud.
>
> Douglas
More information about the threeten-dev
mailing list