TimeHelper (LowEndInsight v0.9.0)

Copy Markdown View Source

Collection of functions for handling time-based conversions.

Summary

Functions

get_commit_delta/1: returns the time between now and the last commit in seconds

sec_to_days/1: returns a roll-up of days from a number of secs

sec_to_str/1: returns a string breakdown of total seconds into weeks, days, hours, minutes and remaining seconds.

sec_to_weeks/1: returns a roll-up of weeks from a number of secs

Functions

get_commit_delta(last_commit_date)

get_commit_delta/1: returns the time between now and the last commit in seconds

sec_to_days(sec)

@spec sec_to_days(non_neg_integer()) :: non_neg_integer()

sec_to_days/1: returns a roll-up of days from a number of secs

sec_to_str(sec)

@spec sec_to_str(non_neg_integer()) :: String.t()

sec_to_str/1: returns a string breakdown of total seconds into weeks, days, hours, minutes and remaining seconds.

Examples

  iex> TimeHelper.sec_to_str(5211)
  "1 hr, 26 min, 51 sec"

sec_to_weeks(sec)

@spec sec_to_weeks(non_neg_integer()) :: non_neg_integer()

sec_to_weeks/1: returns a roll-up of weeks from a number of secs

sum_ts_diff(list)

@spec sum_ts_diff([any()]) :: {:ok, non_neg_integer()}

sum_ts_diff(list, accumulator)

@spec sum_ts_diff([any()], non_neg_integer()) :: {:ok, non_neg_integer()}

sum_ts_diff/2