tarearbol v0.4.1 Tarearbol.Utils

Set of utilities used in Tarearbol. It currently includes human-to-machine interval conversions and options extractor.

Link to this section Summary

Functions

Adds an interval to the given DateTime instance (or to DateTime.utc_now if none given, returning the DateTime instance

Converts a human representation of time interval to the one understandable by a computer. The conversion rules are

Link to this section Types

Link to this type interval()
interval ::
  Integer.t |
  Float.t |
  :none |
  :tiny |
  :medium |
  :regular |
  :timeout |
  :infinity |
  :random

Link to this section Functions

Link to this function add_interval(input, to \\ nil)
add_interval(Interval.t, DateTime.t | nil) :: DateTime.t

Adds an interval to the given DateTime instance (or to DateTime.utc_now if none given, returning the DateTime instance.

Link to this function cron_to_time(at)
Link to this function interval(input, opts \\ [])
interval(Interval.t, List.t) :: Integer.t

Converts a human representation of time interval to the one understandable by a computer. The conversion rules are:

  • integer → amount to be used as is (milliseconds for delay, number for attempts);
  • float → amount of thousands, rounded (seconds for delay, thousands for attempts);
  • :none0;
  • :tiny10;
  • :medium100;
  • :infinity-1, :attempts only.