effect-io-ai

Package: effect
Module: Effect

Effect.clock

Retrieves the Clock service from the context.

Example

import { Effect } from "effect"

const program = Effect.gen(function*() {
  const clock = yield* Effect.clock
  const currentTime = yield* clock.currentTimeMillis
  console.log(`Current time in milliseconds: ${currentTime}`)
})

Effect.runFork(program)
// Example Output:
// Current time in milliseconds: 1735484796134

Signature

declare const clock: Effect<Clock.Clock, never, never>

Source

Since v2.0.0