[threeten-dev] [threeten-develop] Leap seconds and the Java time-scale

Douglas Surber douglas.surber at oracle.com
Mon Apr 8 08:22:27 PDT 2013


At 03:25 AM 4/7/2013, Stephen Colebourne wrote:
>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.

Agreed but they might code differently depending on the properties of 
the clock. For example, it may be possible to use a quick simple 
algorithm with a monotonic, high precision clock but necessary to use 
a more complicated, slower algorithm with a possibly non-monotonic or 
low precision clock.

At some level an implementation must specify these properties of each 
Clock. They can be human readable via JavaDoc or machine readable. 
Making them machine readable will insure that every implementation 
specifies them in a well defined way. It incidentally makes the 
information available to code.

This is not a high priority item, but I think it is at least worth 
considering.

Douglas


>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
>
>------------------------------------------------------------------------------
>Minimize network downtime and maximize team effectiveness.
>Reduce network management and security costs.Learn how to hire
>the most talented Cisco Certified professionals. Visit the
>Employer Resources Portal
>http://www.cisco.com/web/learning/employer_resources/index.html
>_______________________________________________
>threeten-develop mailing list
>threeten-develop at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/threeten-develop



More information about the threeten-dev mailing list