tempo/internal/unit
Units to be shared by the Period and Duration APIs.
Types
pub type Unit {
Year
Month
Week
Day
Hour
CalculatedYear(years: Int, nanoseconds: Int)
CalculatedMonth(months: Int, nanoseconds: Int)
Minute
Second
Millisecond
Microsecond
Nanosecond
Nothing
}
Constructors
-
Year -
Month -
Week -
Day -
Hour -
CalculatedYear(years: Int, nanoseconds: Int) -
CalculatedMonth(months: Int, nanoseconds: Int) -
Minute -
Second -
Millisecond -
Microsecond -
Nanosecond -
Nothing
Constants
pub const hour_nanoseconds: Int
pub const imprecise_day_nanoseconds: Int
pub const imprecise_month_nanoseconds: Int
pub const imprecise_week_nanoseconds: Int
pub const imprecise_year_nanoseconds: Int
pub const microsecond_nanoseconds: Int
pub const millisecond_nanoseconds: Int
pub const minute_nanoseconds: Int
pub const second_nanoseconds: Int
Functions
pub fn as_days_fractional(nanoseconds: Int) -> Float
pub fn as_days_imprecise(nanoseconds: Int) -> Int
pub fn as_hours_fractional(nanoseconds: Int) -> Float
pub fn as_microseconds(nanoseconds: Int) -> Int
pub fn as_microseconds_fractional(nanoseconds: Int) -> Float
pub fn as_milliseconds(nanoseconds: Int) -> Int
pub fn as_milliseconds_fractional(nanoseconds: Int) -> Float
pub fn as_minutes(nanoseconds: Int) -> Int
pub fn as_minutes_fractional(nanoseconds: Int) -> Float
pub fn as_months_imprecise(nanoseconds: Int) -> Int
pub fn as_months_imprecise_fractional(nanoseconds: Int) -> Float
pub fn as_nanoseconds(nanoseconds: Int) -> Int
pub fn as_seconds(nanoseconds: Int) -> Int
pub fn as_seconds_fractional(nanoseconds: Int) -> Float
pub fn as_unit_fractional(nanoseconds: Int, unit: Unit) -> Float
pub fn as_weeks_imprecise(nanoseconds: Int) -> Int
pub fn as_weeks_imprecise_fractional(nanoseconds: Int) -> Float
pub fn as_years_imprecise(nanoseconds: Int) -> Int
pub fn as_years_imprecise_fractional(nanoseconds: Int) -> Float
pub fn format_as(
nanoseconds: Int,
unit unit: Unit,
decimals decimals: Int,
) -> String
pub fn format_as_many(
nanoseconds: Int,
units units: List(Unit),
decimals decimals: Int,
) -> String
pub fn imprecise_days(days: Int) -> Int
pub fn imprecise_months(months: Int) -> Int
pub fn imprecise_weeks(weeks: Int) -> Int
pub fn imprecise_years(years: Int) -> Int
pub fn in_nanoseconds(unit: Unit) -> Int
pub fn microseconds(microseconds: Int) -> Int
pub fn milliseconds(milliseconds: Int) -> Int
pub fn nanoseconds(nanoseconds: Int) -> Int
pub fn unit_to_string(unit: Unit) -> String