exmorph v0.1.0 Exmorph.Time
Summary
Functions
Takes a string representing time and returns the integer value for that time in nanoseconds
Returns the current system time in nanoseconds
Takes an atom with a duration as the first element and unit of time as the second. Returns the duration converted to nanoseconds
Functions
Takes a string representing time and returns the integer value for that time in nanoseconds.
## Examples
iex> Exmorph.Time.from_string("100000ms")
1.0e11
iex> Exmorph.Time.from_string("10s")
10000000000
iex> Exmorph.Time.from_string("3min")
180000000000
iex> Exmorph.Time.from_string("1hr")
3600000000000
Takes an atom with a duration as the first element and unit of time as the second. Returns the duration converted to nanoseconds.
Examples
iex> Exmorph.Time.to_nano({8_888, :milli_seconds})
8.888e9
iex> Exmorph.Time.to_nano({88, :seconds})
88000000000
iex> Exmorph.Time.to_nano({64, :minutes})
3840000000000
iex> Exmorph.Time.to_nano({4, :hours})
14400000000000