Skip to content

Clock

12 exports Added in v2.0.0 Source

Constructors

clockWith

Added in v2.0.0 Source

Signature

declare const clockWith: <A, E, R>(
  f: (clock: Clock) => Effect.Effect<A, E, R>,
) => Effect.Effect<A, E, R>;

Signature

declare const currentTimeMillis: Effect.Effect<number>;

Signature

declare const currentTimeNanos: Effect.Effect<bigint>;

make

Added in v2.0.0 Source

Signature

declare const make: (_: void) => Clock;

sleep

Added in v2.0.0 Source

Signature

declare const sleep: (duration: Duration.DurationInput) => Effect.Effect<void>;

Context

Clock

Added in v2.0.0 Source

Signature

declare const Clock: Tag<Clock, Clock>;

Models

CancelToken type

Added in v2.0.0 Source

Signature

type CancelToken = () => boolean;

Clock interface

Added in v2.0.0 Source

Represents a time-based clock which provides functionality related to time and scheduling.

Signature

interface Clock {
  readonly [ClockTypeId]: typeof ClockTypeId;
  readonly currentTimeMillis: Effect<number>;
  readonly currentTimeNanos: Effect<bigint>;
  sleep(duration: Duration): Effect<void>;
  unsafeCurrentTimeMillis(): number;
  unsafeCurrentTimeNanos(): bigint;
}

ClockScheduler interface

Added in v2.0.0 Source

Signature

interface ClockScheduler {
  unsafeSchedule(task: Task, duration: Duration): CancelToken;
}

Task type

Added in v2.0.0 Source

Signature

type Task = () => void;

Symbols

ClockTypeId

Added in v2.0.0 Source

Signature

declare const ClockTypeId: unique symbol;

ClockTypeId type

Added in v2.0.0 Source

Signature

type ClockTypeId = typeof ClockTypeId;