On Mon, 17 May 2021 14:04:24 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> 8266846: Add java.time.InstantSource
>
> src/java.base/share/classes/java/time/InstantSource.java line 36:
> 
>> 34:  * Instances of this interface are used to find the current instant.
>> 35:  * As such, an {@code InstantSource} can be used instead of {@link 
>> System#currentTimeMillis()}.
>> 36:  * <p>
> 
> The word 'current' is likely to misleading here.  The specification of an 
> interface does not have any context in which to describe what the instant 
> represents or what it is relative to.
> Given the intended use cases, it is definitely not always related to 
> System.currentTimeMillis() 
> which is bound to the running system.
> i think the best you could say is that it returns an instant provided by the 
> source as does the 'instance()' method.

This is the definition used by `Clock` since Java 8. It is also the purpose of 
the interface. ie. this isn't an interface for providing instants in general, 
but for providing the _current instant_. I can clarify wrt the meaning of 
"current", but I don't see how that word can be avoided.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4016

Reply via email to