Exqute v0.1.3 Exqute.Utils.Time View Source

Time utilities for the Exqute app

Link to this section Summary

Functions

Get the configured Time Zone information

What time is it now?

Scales the specified duration in the test environment mainly.

Returns the timezone if it is valid, or the default configured zone

Link to this section Functions

Link to this function

configured_zone()

View Source
configured_zone() :: String.t()

Get the configured Time Zone information

iex> Exqute.Utils.Time.configured_zone
"UTC"

What time is it now?

Link to this function

scale_duration(duration)

View Source
scale_duration(integer()) :: integer()

Scales the specified duration in the test environment mainly.

Link to this function

with_zone_or_default(timezone)

View Source
with_zone_or_default(String.t()) ::
  {:ok, String.t(), String.t()} | {:error, String.t(), String.t()}

Returns the timezone if it is valid, or the default configured zone

iex> Exqute.Utils.Time.with_zone_or_default("*")
{:ok, "UTC", "No zone detected"}

iex> Exqute.Utils.Time.with_zone_or_default("Asia/Kolkata")
{:ok, "Asia/Kolkata", "Zone exists"}

iex> Exqute.Utils.Time.with_zone_or_default("Marvel/Asgard")
{:error, "UTC", "Invalid zone"}