Clock overview
Added in v1.0.0
Table of contents
constructors
clockWith
Signature
export declare const clockWith: <R, E, A>(f: (clock: Clock) => Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>
Added in v1.0.0
currentTimeMillis
Signature
export declare const currentTimeMillis: Effect.Effect<never, never, number>
Added in v1.0.0
currentTimeNanos
Signature
export declare const currentTimeNanos: Effect.Effect<never, never, bigint>
Added in v1.0.0
make
Signature
export declare const make: (_: void) => Clock
Added in v1.0.0
sleep
Signature
export declare const sleep: (duration: Duration.DurationInput) => Effect.Effect<never, never, void>
Added in v1.0.0
context
Clock
Signature
export declare const Clock: Context.Tag<Clock, Clock>
Added in v1.0.0
models
CancelToken (type alias)
Signature
export type CancelToken = () => boolean
Added in v1.0.0
Clock (interface)
Represents a time-based clock which provides functionality related to time and scheduling.
Signature
export interface Clock {
readonly [ClockTypeId]: ClockTypeId
/**
* Unsafely returns the current time in milliseconds.
*/
unsafeCurrentTimeMillis(): number
/**
* Returns the current time in milliseconds.
*/
readonly currentTimeMillis: Effect.Effect<never, never, number>
/**
* Unsafely returns the current time in nanoseconds.
*/
unsafeCurrentTimeNanos(): bigint
/**
* Returns the current time in nanoseconds.
*/
readonly currentTimeNanos: Effect.Effect<never, never, bigint>
/**
* Asynchronously sleeps for the specified duration.
*/
sleep(duration: Duration.Duration): Effect.Effect<never, never, void>
}
Added in v1.0.0
ClockScheduler (interface)
Signature
export interface ClockScheduler {
/**
* Unsafely schedules the specified task for the specified duration.
*/
readonly unsafeSchedule: (task: Task, duration: Duration.Duration) => CancelToken
}
Added in v1.0.0
Task (type alias)
Signature
export type Task = () => void
Added in v1.0.0
symbols
ClockTypeId
Signature
export declare const ClockTypeId: typeof ClockTypeId
Added in v1.0.0
ClockTypeId (type alias)
Signature
export type ClockTypeId = typeof ClockTypeId
Added in v1.0.0