stella v0.6.0 Time

Documentation for Time module.

Link to this section Summary

Functions

Converts HH:MM:SS time type to seconds (integer)

Converts HH:MM:SS time type to seconds (integer)

Converts miliseconds to HHMMSS format

Converts miliseconds to seconds (float)

Converts seconds to HHMMSS format

Converts seconds to miliseconds (integer)

Link to this section Functions

Specs

hms_to_ms(binary()) :: number()

Converts HH:MM:SS time type to seconds (integer)

Examples

iex> Time.hms_to_ms("0:1:10")
70000
Link to this function

hms_to_sec(hms)

Specs

hms_to_sec(binary()) :: number()

Converts HH:MM:SS time type to seconds (integer)

Examples

iex> Time.hms_to_sec("0:1:10")
70
Link to this function

ms_to_hms(ms, separator \\ ":")

Specs

ms_to_hms(integer(), binary()) :: binary()

Converts miliseconds to HHMMSS format

Examples

iex> Time.ms_to_hms(28565000)
"07:56:05"

iex> Time.ms_to_hms(1000)
"00:00:01"

iex> Time.ms_to_hms(1000, "-")
"00-00-01"

iex> Time.ms_to_hms(61000)
"00:01:01"

Specs

ms_to_sec(number()) :: float()

Converts miliseconds to seconds (float)

Examples

iex> Time.ms_to_sec(1000)
1.0
Link to this function

sec_to_hms(sec, separator \\ ":")

Specs

sec_to_hms(integer(), binary()) :: binary()

Converts seconds to HHMMSS format

Examples

iex> Time.sec_to_hms(28565)
"07:56:05"

iex> Time.sec_to_hms(28565, "-")
"07-56-05"

iex> Time.sec_to_hms(1)
"00:00:01"

iex> Time.sec_to_hms(61)
"00:01:01"

Specs

sec_to_ms(number()) :: number()

Converts seconds to miliseconds (integer)

Examples

iex> Time.sec_to_ms(1)
1000