object Clock extends ClockPlatformSpecific with Serializable
- Alphabetic
- By Inheritance
- Clock
- Serializable
- ClockPlatformSpecific
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class ClockJava(clock: java.time.Clock) extends Clock with Product with Serializable
An implementation of the
Clock
service backed by ajava.time.Clock
.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val any: ZLayer[Clock, Nothing, Clock]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def currentDateTime(implicit trace: ZTraceElement): URIO[Clock, OffsetDateTime]
Get the current time, represented in the current timezone.
- def currentTime(unit: => TimeUnit)(implicit trace: ZTraceElement): URIO[Clock, Long]
Returns the current time, relative to the Unix epoch.
- def driver[Env, In, Out](schedule: Schedule[Env, In, Out])(implicit trace: ZTraceElement): URIO[Clock, Driver[State, Env, In, Out]]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def instant(implicit trace: ZTraceElement): ZIO[Clock, Nothing, Instant]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val javaClock: ZLayer[java.time.Clock, Nothing, Clock]
Constructs a
Clock
service from ajava.time.Clock
. - val live: Layer[Nothing, Clock]
- def localDateTime(implicit trace: ZTraceElement): ZIO[Clock, Nothing, LocalDateTime]
- def nanoTime(implicit trace: ZTraceElement): URIO[Clock, Long]
Returns the system nano time, which is not relative to any date.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def repeat[R, R1 <: R, E, A, B](zio: => ZIO[R, E, A])(schedule: => Schedule[R1, A, B])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E, B]
Returns a new effect that repeats this effect according to the specified schedule or until the first failure.
Returns a new effect that repeats this effect according to the specified schedule or until the first failure. Scheduled recurrences are in addition to the first execution, so that
io.repeat(Schedule.once)
yields an effect that executesio
, and then if that succeeds, executesio
an additional time. - final def repeatOrElse[R, R1 <: R, E, E2, A, B](zio: => ZIO[R, E, A])(schedule: => Schedule[R1, A, B], orElse: (E, Option[B]) => ZIO[R1, E2, B])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E2, B]
Returns a new effect that repeats this effect according to the specified schedule or until the first failure, at which point, the failure value and schedule output are passed to the specified handler.
Returns a new effect that repeats this effect according to the specified schedule or until the first failure, at which point, the failure value and schedule output are passed to the specified handler.
Scheduled recurrences are in addition to the first execution, so that
io.repeat(Schedule.once)
yields an effect that executesio
, and then if that succeeds, executesio
an additional time. - final def repeatOrElseEither[R, R1 <: R, E, E2, A, B, C](zio: => ZIO[R, E, A])(schedule: => Schedule[R1, A, B], orElse: (E, Option[B]) => ZIO[R1, E2, C])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E2, Either[C, B]]
Returns a new effect that repeats this effect according to the specified schedule or until the first failure, at which point, the failure value and schedule output are passed to the specified handler.
Returns a new effect that repeats this effect according to the specified schedule or until the first failure, at which point, the failure value and schedule output are passed to the specified handler.
Scheduled recurrences are in addition to the first execution, so that
io.repeat(Schedule.once)
yields an effect that executesio
, and then if that succeeds, executesio
an additional time. - final def retry[R, R1 <: R, E, A, S](zio: => ZIO[R, E, A])(policy: => Schedule[R1, E, S])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1 with Clock, E, A]
Retries with the specified retry policy.
Retries with the specified retry policy. Retries are done following the failure of the original
io
(up to a fixed maximum withonce
orrecurs
for example), so that thatio.retry(Schedule.once)
means "executeio
and in case of failure, try again once". - final def retryOrElse[R, R1 <: R, E, E1, A, A1 >: A, S](zio: => ZIO[R, E, A])(policy: => Schedule[R1, E, S], orElse: (E, S) => ZIO[R1, E1, A1])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1 with Clock, E1, A1]
Retries with the specified schedule, until it fails, and then both the value produced by the schedule together with the last error are passed to the recovery function.
- final def retryOrElseEither[R, R1 <: R, E, E1, A, B, Out](zio: => ZIO[R, E, A])(schedule: => Schedule[R1, E, Out], orElse: (E, Out) => ZIO[R1, E1, B])(implicit ev: CanFail[E], trace: ZTraceElement): ZIO[R1 with Clock, E1, Either[B, A]]
Returns an effect that retries this effect with the specified schedule when it fails, until the schedule is done, then both the value produced by the schedule together with the last error are passed to the specified recovery function.
- final def schedule[R, R1 <: R, E, A, B](zio: => ZIO[R, E, A])(schedule: => Schedule[R1, Any, B])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E, B]
Runs this effect according to the specified schedule.
Runs this effect according to the specified schedule.
See scheduleFrom for a variant that allows the schedule's decision to depend on the result of this effect.
- final def scheduleFrom[R, R1 <: R, E, A, A1 >: A, B](zio: => ZIO[R, E, A])(a: => A1)(schedule: => Schedule[R1, A1, B])(implicit trace: ZTraceElement): ZIO[R1 with Clock, E, B]
Runs this effect according to the specified schedule starting from the specified input value.
- def scheduler(implicit trace: ZTraceElement): URIO[Clock, Scheduler]
Returns the scheduler used for scheduling effects.
- def sleep(duration: => zio.Duration)(implicit trace: ZTraceElement): URIO[Clock, Unit]
Sleeps for the specified duration.
Sleeps for the specified duration. This is always asynchronous.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object ClockLive extends Clock