Liking cljdoc? Tell your friends :D

d-core.libs.time


after?clj

(after? a b)

Returns true if instant a is after instant b.

Returns true if instant a is after instant b.
raw docstring

before?clj

(before? a b)

Returns true if instant a is before instant b.

Returns true if instant a is before instant b.
raw docstring

between?clj

(between? instant start end)

Returns true if instant is within [start, end] inclusive.

Returns true if instant is within [start, end] inclusive.
raw docstring

compare-instantsclj

(compare-instants a b)

Compares two instants (or maps/epoch values). Returns -1, 0, or 1.

Compares two instants (or maps/epoch values). Returns -1, 0, or 1.
raw docstring

durationclj

(duration value)
(duration amount unit)

Creates a Duration. Accepts a map like {:seconds 1 :millis 250}, a Duration instance, or an amount + unit.

Creates a Duration. Accepts a map like {:seconds 1 :millis 250},
a Duration instance, or an amount + unit.
raw docstring

duration->mapclj

(duration->map d)

Converts a Duration to a map with a :millis key.

Converts a Duration to a map with a :millis key.
raw docstring

instant->mapclj

(instant->map inst)
(instant->map inst zone)

Converts an Instant into a time map.

The map uses {:epoch-ms <long>} and optionally a :zone string.

Converts an Instant into a time map.

The map uses {:epoch-ms <long>} and optionally a :zone string.
raw docstring

instant-map?clj

(instant-map? value)

Returns true if the value looks like an instant map.

Supported shapes:

  • {:epoch-ms <long>}
  • {:epoch-second <long> :nano <int>}
Returns true if the value looks like an instant map.

Supported shapes:
- {:epoch-ms <long>}
- {:epoch-second <long> :nano <int>}
raw docstring

instant=clj

(instant= a b)

Returns true if both instants represent the same moment.

Returns true if both instants represent the same moment.
raw docstring

instant?clj

(instant? value)

Returns true if the value is a java.time.Instant.

Returns true if the value is a java.time.Instant.
raw docstring

map->instantclj

(map->instant m)

Converts a time map into an Instant.

Converts a time map into an Instant.
raw docstring

minusclj

(minus value dur)
(minus value unit amount)

Subtracts a duration from a Clock, Instant, or time map.

Subtracts a duration from a Clock, Instant, or time map.
raw docstring

new-clockclj

(new-clock)
(new-clock {:keys [type zone instant clock offset tick] :or {type :system}})

Creates a java.time.Clock.

Options:

  • {:type :system :zone "UTC"}
  • {:type :fixed :instant <instant|map|epoch-ms> :zone "UTC"}
  • {:type :offset :clock <clock|opts> :offset <duration|map>}
  • {:type :tick :clock <clock|opts> :tick <duration|map>}
Creates a java.time.Clock.

Options:
- {:type :system :zone "UTC"}
- {:type :fixed :instant <instant|map|epoch-ms> :zone "UTC"}
- {:type :offset :clock <clock|opts> :offset <duration|map>}
- {:type :tick :clock <clock|opts> :tick <duration|map>}
raw docstring

nowclj

(now)
(now clock)

Returns the current Instant for the provided Clock (or system default).

Returns the current Instant for the provided Clock (or system default).
raw docstring

now-mapclj

(now-map)
(now-map clock)

Returns a time map for now, optionally including the clock zone.

Returns a time map for now, optionally including the clock zone.
raw docstring

plusclj

(plus value dur)
(plus value unit amount)

Adds a duration to a Clock, Instant, or time map.

When called with a Clock, uses now as the base. When called with a map, returns a map.

Adds a duration to a Clock, Instant, or time map.

When called with a Clock, uses now as the base.
When called with a map, returns a map.
raw docstring

sinceclj

(since instant)
(since clock instant)

Returns a Duration between an instant (or map) and now.

Returns a Duration between an instant (or map) and now.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close