MCPcopy Create free account
hub / github.com/Effect-TS/effect / toNanos

Function toNanos

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

decodeFunction · 0.70

Tested by

no test coverage detected