Instant.now(Clock) and InstantSource
Stephen Colebourne
scolebourne at joda.org
Tue Jun 4 07:17:07 UTC 2024
On Mon, 3 Jun 2024 at 22:25, Kurt Alfred Kluever <kak at google.com> wrote:
> It feels a bit strange that you can't pass an `InstantSource` to `Instant.now(...)`, but you _can_ pass a `Clock` (which of course has a "useless" `ZoneId` when creating an `Instant`). Therefore, I'd like to propose one of the following API changes:
>
> 1) adding `Instant.now(InstantSource)`
> 2) deprecating `Instant.now(Clock)` in favor of `clock.instant()`
I have no problem with adding `Instant.now(InstantSource)`, but I
think deprecating the `Clock` method is unnecessary (given it will
never be removed AFAICT, and it is no doubt in widespread use).
Stephen
More information about the core-libs-dev
mailing list