Run pre-commit.
All checks were successful
/ Build and Release Library (push) Successful in 1m14s

This commit is contained in:
Pat Garrity 2024-09-10 21:35:36 -05:00
parent dd415c957a
commit 1221fc85e8
Signed by: pfm
GPG key ID: 5CA5D21BAB7F3A76

View file

@ -75,8 +75,7 @@ object MonotonicProvider:
final class SystemProvider[F[_]: Sync] extends MonotonicProvider[F]: final class SystemProvider[F[_]: Sync] extends MonotonicProvider[F]:
override def monotonic(): F[Long] = Sync[F].delay(System.nanoTime()) override def monotonic(): F[Long] = Sync[F].delay(System.nanoTime())
/** /** Manual implementation of the [[MonotonicProvider]] that allows the caller
* Manual implementation of the [[MonotonicProvider]] that allows the caller
* to directly increment/set a tick count, where each tick corresponds to one * to directly increment/set a tick count, where each tick corresponds to one
* nanosecond of elapsed time. * nanosecond of elapsed time.
* *
@ -90,26 +89,25 @@ object MonotonicProvider:
final class ManualTickProvider[F[_]: Sync] private ( final class ManualTickProvider[F[_]: Sync] private (
ticks: Ref[F, Long] ticks: Ref[F, Long]
) extends MonotonicProvider[F]: ) extends MonotonicProvider[F]:
/** /** @return
* @return The current tick count. * The current tick count.
*/ */
override def monotonic(): F[Long] = ticks.get override def monotonic(): F[Long] = ticks.get
/** /** Increment the tick count by 1.
* Increment the tick count by 1.
*/ */
def tick(): F[Unit] = ticks.update(_ + 1) def tick(): F[Unit] = ticks.update(_ + 1)
/** /** Set the tick count to a specific value.
* Set the tick count to a specific value.
* *
* @param newTickCount The new tick count value. * @param newTickCount
* @return Side-effect. * The new tick count value.
* @return
* Side-effect.
*/ */
def set(newTickCount: Long): F[Unit] = ticks.set(newTickCount) def set(newTickCount: Long): F[Unit] = ticks.set(newTickCount)
/** /** Reset the tick count to 0.
* Reset the tick count to 0.
*/ */
def reset(): F[Unit] = ticks.set(0) def reset(): F[Unit] = ticks.set(0)