Bedrock.Internal.Time.Interval (bedrock v0.6.0)

View Source

Time interval utilities for measuring elapsed time and duration calculations.

Summary

Types

t()

@type t() :: {unit(), n :: non_neg_integer() | float()}

unit()

@type unit() ::
  :week
  | :day
  | :hour
  | :minute
  | :second
  | :millisecond
  | :microsecond
  | :nanosecond

Functions

between(start, stop, unit \\ :second)

@spec between(DateTime.t(), DateTime.t(), unit()) :: t()

from(unit, n)

@spec from(unit(), non_neg_integer() | float()) :: t()

humanize(i)

@spec humanize({unit(), n :: number()}) :: String.t()

normalize(perfect)

@spec normalize({unit(), number()}) :: t()

unit_abbreviation(atom)

@spec unit_abbreviation(unit()) :: String.t()