Hyperlinkv0.8.0-beta.28

Clock

Clock.currentTimeMillisconsteffect/Clock.ts:169
Effect<number, never, never>

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

When to use

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

Example (Reading milliseconds)

import { Clock, Effect } from "effect"

const program = Effect.gen(function*() {
  const currentTime = yield* Clock.currentTimeMillis
  console.log(`Current time: ${currentTime}ms`)
  return currentTime
})
Source effect/Clock.ts:1691 lines
export const currentTimeMillis: Effect<number> = effect.currentTimeMillis
Referenced by 2 symbols