Hyperlinkv0.8.0-beta.28

Clock

Clock.currentTimeNanosconsteffect/Clock.ts:194
Effect<bigint, never, never>

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
})
constructors
Source effect/Clock.ts:1941 lines
export const currentTimeNanos: Effect<bigint> = effect.currentTimeNanos
Referenced by 1 symbols