add

open fun add(amountToAdd: TemporalAmount)

Adds the specified amount to this clock.

Atomically updates this clock to the value of the following expression:

  ZonedDateTime.now(thisClock)
               .plus(amountToAdd)
               .toInstant()

Parameters

amountToAdd

the amount to add, not null

See also

Throws

if the addition cannot be made

if numeric overflow occurs


open fun add(amountToAdd: Long, unit: TemporalUnit)

Adds the specified amount to this clock.

Atomically updates this clock to the value of the following expression:

  ZonedDateTime.now(thisClock)
               .plus(amountToAdd, unit)
               .toInstant()

Parameters

amountToAdd

the amount of the specified unit to add, may be negative

unit

the unit of the amount to add, not null

See also

Throws

if the unit cannot be added

if numeric overflow occurs