io.randomseed.utils.time
added in 1.0.0
Random utilities, date and time functions.
date-to-local-utc
(date-to-local-utc t)
days
(days v)
(days v default)
days-ago
(days-ago n)
Returns a time of days ago from now.
duration->time
(duration->time duration)
(duration->time duration t)
duration-or-time
(duration-or-time v)
(duration-or-time v t)
hours
(hours v)
(hours v default)
instant-utc
(instant-utc)
(instant-utc v)
local-utc-delta
(local-utc-delta)
millis
(millis v)
(millis v default)
minutes
(minutes v)
(minutes v default)
neg-duration?
(neg-duration? d)
parse-dt-secs
(parse-dt-secs s)
parse-dur-min
(parse-dur-min v)
parse-duration
(parse-duration d)
(parse-duration d default-unit)
(parse-duration d default-unit & pairs)
Parses time duration expressed as value and unit. For a single argument being a single value it is treated as minutes. For a single value being a collection the function is applied to consecutive values. For the given d
and default-unit
the value of d
is parsed as a long number and the unit is converted into a keyword and should be one of the: :day
, :hour
, :minute
, :second
, :millisecond
, :microsecond
or :nanosecond
(including their corresponding plural forms). When multiple arguments are given they are parsed in pairs and added to create a single duration.
parse-ts-secs
(parse-ts-secs s)
pos-duration?
(pos-duration? d)
safe-parse-dt
(safe-parse-dt s)
safe-parse-dt-secs
(safe-parse-dt-secs s)
safe-parse-ts
(safe-parse-ts s)
safe-parse-ts-secs
(safe-parse-ts-secs s)
seconds
(seconds v)
(seconds v default)
time->duration
(time->duration t)
(time->duration from-time to-time)
time-unit
(time-unit v default-unit)
(time-unit v default-unit extraction-fn)
timestamp
(timestamp)
(timestamp t)
timestamp-secs
(timestamp-secs)
(timestamp-secs t)
try-times
macro
(try-times & body)
Executes body. If an exception is thrown, will retry. At most n retries are done. If still some exception is thrown it is bubbled upwards in the call chain.
try-times*
(try-times* times thunk)
utc-instant
(utc-instant)
(utc-instant v)
utc-to-local-date
(utc-to-local-date t)
zero-duration?
(zero-duration? d)