Skip to content

Commit

Permalink
Fix DurationKt.minus
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelCourtney committed Oct 22, 2024
1 parent 89d84a9 commit 2399ccd
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ operator fun Duration.rem(divisor: Duration): Duration = this.remainderOf(diviso
operator fun Instant.plus(duration: Duration): Instant = plusMillis(duration / MILLISECOND)
.plusNanos(1000 * ((duration % MILLISECOND) / MICROSECOND))

/** Subtracts a duration from an instant, to produce another instant. */
/** Subtracts an instant from another instant, represented as a duration. */
operator fun Instant.minus(other: Instant): Duration = microseconds(other.until(this, ChronoUnit.MICROS))

/** Subtracts a duration from an instant, to produce another instant. */
operator fun Instant.minus(duration: Duration) = this.plus(-duration)

0 comments on commit 2399ccd

Please sign in to comment.