io.randomseed.utils.time

added in 1.0.0

Random utilities, date and time functions.

add-second

(add-second t)

date-time-rpat

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-map

duration-or-time

(duration-or-time v)(duration-or-time v t)

duration?

(duration? v)

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)

milliseconds

minutes

(minutes v)(minutes v default)

neg-duration?

(neg-duration? d)

one-second

parse-dt

(parse-dt s)

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

(parse-ts s)

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)

sub-second

(sub-second t)

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)

timeish?

(timeish? v)

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)

tstamp-pat

unit-to-efn

utc

utc-instant

(utc-instant)(utc-instant v)

utc-to-local-date

(utc-to-local-date t)

zero-duration?

(zero-duration? d)