View Source Chaperon.Timing (chaperon v0.3.1)

Timing related helper functions and type definitions used within Chaperon.

Link to this section Summary

Functions

Returns the correct amount of milliseconds for a given amount of days.

Returns the correct amount of milliseconds for a given amount of hours.

Returns the correct amount of milliseconds for a given amount of minutes.

Returns the correct amount of milliseconds for a given amount of seconds.

Returns a timestamp with the given time unit.

Returns the correct amount of milliseconds for a given amount of weeks.

Link to this section Types

@type duration() :: duration_number() | {:random, duration_number()}
@type duration_number() :: non_neg_integer() | float() | Range.t()
@type time_unit() :: :seconds | :milli_seconds | :micro_seconds | :nano_seconds

Link to this section Functions

@spec days(duration()) :: non_neg_integer()

Returns the correct amount of milliseconds for a given amount of days.

@spec hours(duration()) :: non_neg_integer()

Returns the correct amount of milliseconds for a given amount of hours.

@spec minutes(duration()) :: non_neg_integer()

Returns the correct amount of milliseconds for a given amount of minutes.

@spec seconds(duration()) :: non_neg_integer()

Returns the correct amount of milliseconds for a given amount of seconds.

Link to this function

timestamp(unit \\ :milli_seconds)

View Source
@spec timestamp(time_unit()) :: non_neg_integer()

Returns a timestamp with the given time unit.

@spec weeks(duration()) :: non_neg_integer()

Returns the correct amount of milliseconds for a given amount of weeks.