Clock

object Clock extends ClockPlatformSpecific with Serializable
Companion:
class
trait ClockPlatformSpecific
class Object
trait Matchable
class Any
Clock.type

Type members

Classlikes

final case class ClockJava(clock: Clock) extends Clock

An implementation of the Clock service backed by a java.time.Clock.

An implementation of the Clock service backed by a java.time.Clock.

object ClockLive extends Clock

Value members

Concrete methods

def currentDateTime(implicit trace: Trace): UIO[OffsetDateTime]

Get the current time, represented in the current timezone.

Get the current time, represented in the current timezone.

def currentTime(unit: => TimeUnit)(implicit trace: Trace): UIO[Long]

Returns the current time, relative to the Unix epoch.

Returns the current time, relative to the Unix epoch.

def instant(implicit trace: Trace): UIO[Instant]
def javaClock(implicit trace: Trace): UIO[Clock]

Constructs a java.time.Clock backed by the Clock service.

Constructs a java.time.Clock backed by the Clock service.

def localDateTime(implicit trace: Trace): UIO[LocalDateTime]
def nanoTime(implicit trace: Trace): UIO[Long]

Returns the system nano time, which is not relative to any date.

Returns the system nano time, which is not relative to any date.

def scheduler(implicit trace: Trace): UIO[Scheduler]

Returns the scheduler used for scheduling effects.

Returns the scheduler used for scheduling effects.

def sleep(duration: => Duration)(implicit trace: Trace): UIO[Unit]

Sleeps for the specified duration. This is always asynchronous.

Sleeps for the specified duration. This is always asynchronous.

Concrete fields

val any: ZLayer[Clock, Nothing, Clock]
val javaClock: ZLayer[Clock, Nothing, Clock]

Constructs a Clock service from a java.time.Clock.

Constructs a Clock service from a java.time.Clock.

val live: Layer[Nothing, Clock]