phasedb v0.0.2 PhaseDB.TimeHelpers
Helpful functions for dealing with datetimes and intervals.
Summary
Functions
Return the current time minus the interval
Turn a Calendar.DateTime
into UTC microseconds
Convert an interval into an approximate description
Returns true if the accuracy of the UTC microseconds match the specified resolution
Return the current time in UTC as a Calendar.DateTime
Return the current time in UTC microseconds
Convert UTC microseconds back to a Calendar.DateTime
Remove accuracy from UTC microseconds according to the specified resolution
Create a time interval in UTC microseconds based on a count and a unit
Types
interval_unit_med ::
:usec |
:usecs |
:msec |
:msecs |
:sec |
:secs |
:min |
:mins |
:hour |
:hours |
:day |
:days |
:week |
:weeks |
:year |
:years
interval_unit_short ::
:u |
:ms |
:s |
:m |
:h |
:d |
:w |
:y
interval_usecs :: integer
utc_usecs :: integer
Functions
Specs
in_usecs(Calendar.DateTime.t) :: utc_usecs
Turn a Calendar.DateTime
into UTC microseconds.
Specs
interval_to_string(interval_usecs) :: String.t
Convert an interval into an approximate description.
Specs
matches_resolution?(utc_usecs, interval_usecs) :: boolean
Returns true if the accuracy of the UTC microseconds match the specified resolution.
Specs
to_datetime(utc_usecs) :: Calendar.DateTime.t
Convert UTC microseconds back to a Calendar.DateTime
.
Specs
to_resolution(utc_usecs, interval_usecs) :: utc_usecs
Remove accuracy from UTC microseconds according to the specified resolution.
Specs
usecs(n :: integer, unit :: interval_unit) :: interval_usecs
Create a time interval in UTC microseconds based on a count and a unit.