Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/core/shared/src/main/scala/scalaz/zio/clock/package.scala b/core/shared/src/main/scala/scalaz/zio/clock/package.scala
- index 5691082e..33cfcb61 100644
- --- a/core/shared/src/main/scala/scalaz/zio/clock/package.scala
- +++ b/core/shared/src/main/scala/scalaz/zio/clock/package.scala
- @@ -17,28 +17,37 @@
- package scalaz.zio
- import scalaz.zio.duration.Duration
- -
- import java.util.concurrent.TimeUnit
- -package object clock extends Clock.Service[Clock] {
- - final val clockService: ZIO[Clock, Nothing, Clock.Service[Any]] =
- - ZIO.access(_.clock)
- -
- - /**
- - * Returns the current time, relative to the Unix epoch.
- - */
- - final def currentTime(unit: TimeUnit): ZIO[Clock, Nothing, Long] =
- - ZIO.accessM(_.clock currentTime unit)
- -
- - /**
- - * Returns the system nano time, which is not relative to any date.
- - */
- - final val nanoTime: ZIO[Clock, Nothing, Long] =
- - ZIO.accessM(_.clock.nanoTime)
- -
- - /**
- - * Sleeps for the specified duration. This is always asynchronous.
- - */
- - final def sleep(duration: Duration): ZIO[Clock, Nothing, Unit] =
- - ZIO.accessM(_.clock sleep duration)
- +package object clock {
- + final val clockService:ZIO[Clock, Nothing, Clock.Service[Any]] = clockPackage.clockService
- + final def currentTime(unit: TimeUnit): ZIO[Clock, Nothing, Long] = clockPackage.currentTime(unit)
- + final val nanoTime: ZIO[Clock, Nothing, Long] = clockPackage.nanoTime
- + final def sleep(duration: Duration): ZIO[Clock, Nothing, Unit] = clockPackage.sleep(duration)
- +
- +
- + private object clockPackage extends Clock.Service[Clock] {
- + final val clockService: ZIO[Clock, Nothing, Clock.Service[Any]] =
- + ZIO.access(_.clock)
- +
- + /**
- + * Returns the current time, relative to the Unix epoch.
- + */
- + final def currentTime(unit: TimeUnit): ZIO[Clock, Nothing, Long] =
- + ZIO.accessM(_.clock currentTime unit)
- +
- + /**
- + * Returns the system nano time, which is not relative to any date.
- + */
- + final val nanoTime: ZIO[Clock, Nothing, Long] =
- + ZIO.accessM(_.clock.nanoTime)
- +
- + /**
- + * Sleeps for the specified duration. This is always asynchronous.
- + */
- + final def sleep(duration: Duration): ZIO[Clock, Nothing, Unit] =
- + ZIO.accessM(_.clock sleep duration)
- + }
- +
- }
- +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement