MCPcopy Index your code
hub / github.com/Effect-TS/effect / toNanos

Function toNanos

packages/effect/src/Duration.ts:362–372  ·  view source on GitHub ↗
(self: DurationInput)

Source from the content-addressed store, hash-verified

360 * @category getters
361 */
362export const toNanos = (self: DurationInput): Option.Option<bigint> => {
363 const _self = decode(self)
364 switch (_self.value._tag) {
365 case "Infinity":
366 return Option.none()
367 case "Nanos":
368 return Option.some(_self.value.nanos)
369 case "Millis":
370 return Option.some(BigInt(Math.round(_self.value.millis * 1_000_000)))
371 }
372}
373
374/**
375 * Get the duration in nanoseconds as a bigint.

Callers

nothing calls this directly

Calls 1

decodeFunction · 0.70

Tested by

no test coverage detected