ClockModule

PackageAxial.PlatformService
Helpers for the clock service.

Summary

NameSignatureSynopsis
Operations
serviceClock.service Reads the service from the environment.
nowClock.now Reads the current UTC timestamp from an explicit clock service.
utcDateTimeClock.utcDateTime Reads the current UTC date/time from an explicit clock service.
unixTimeSecondsClock.unixTimeSeconds Reads the current Unix timestamp in seconds from an explicit clock service.
unixTimeMillisecondsClock.unixTimeMilliseconds Reads the current Unix timestamp in milliseconds from an explicit clock service.
elapsedClock.elapsed Reads a monotonic timestamp from an explicit clock service.
timedClock.timed flowRuns a flow and returns its value together with how long it took.
liveClock.live Creates a live clock backed by and a monotonic timer.
fromValueClock.fromValue utcNowCreates a deterministic clock that always returns the supplied instant; measured durations are zero.
layerClock.layer Builds the live clock as a layer.

Operations

kind:member

service

Clock.service
Member
Reads the service from the environment.

Returns

Flow<'env, 'error, IClock>
kind:member

now

Clock.now
Member
Reads the current UTC timestamp from an explicit clock service.

Returns

Flow<'env, 'error, DateTimeOffset>
kind:member

utcDateTime

Clock.utcDateTime
Member
Reads the current UTC date/time from an explicit clock service.

Returns

Flow<'env, 'error, DateTime>
kind:member

unixTimeSeconds

Clock.unixTimeSeconds
Member
Reads the current Unix timestamp in seconds from an explicit clock service.

Returns

Flow<'env, 'error, int64>
kind:member

unixTimeMilliseconds

Clock.unixTimeMilliseconds
Member
Reads the current Unix timestamp in milliseconds from an explicit clock service.

Returns

Flow<'env, 'error, int64>
kind:member

elapsed

Clock.elapsed
Member
Reads a monotonic timestamp from an explicit clock service.

Returns

Flow<'env, 'error, TimeSpan>
kind:member

timed

Clock.timed flow
Member
Runs a flow and returns its value together with how long it took.

Parameters

NameTypeDescription
flowFlow<'env, 'error, 'value>The flow to measure.

Returns

Flow<'env, 'error, ('value * TimeSpan)>

Verification Examples

let! report, took = buildReport |> Clock.timed
kind:member

live

Clock.live
Member
Creates a live clock backed by UtcNow and a monotonic timer.

Returns

IClock
kind:member

fromValue

Clock.fromValue utcNow
Member
Creates a deterministic clock that always returns the supplied instant; measured durations are zero.

Parameters

NameTypeDescription
utcNowDateTimeOffset

Returns

IClock
kind:member

layer

Clock.layer
Member
Builds the live clock as a layer.

Returns

Layer<unit, Never, IClock>