Package: effect
Module: Clock
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
})
See
currentTimeNanos for nanosecond precisionclockWith for accessing the full Clock serviceSignature
declare const currentTimeMillis: Effect<number, never, never>
Since v2.0.0