effect-io-ai

Package: effect
Module: Clock

Clock.currentTimeNanos

Returns an Effect that succeeds with the current time in nanoseconds.

When to use

Use to read wall-clock time from the active Clock service with nanosecond precision.

Example (Reading nanoseconds)

import { Clock, Effect } from "effect"

const program = Effect.gen(function*() {
  const currentTime = yield* Clock.currentTimeNanos
  console.log(`Current time: ${currentTime}ns`)
  return currentTime
})

Signature

declare const currentTimeNanos: Effect<bigint, never, never>

Source

Since v2.0.0