Liking cljdoc? Tell your friends :D

puppetlabs.puppetdb.time

Time-related Utility Functions

This namespace contains utility functions for working with time objects, built on java.time.Instant (timestamps) and java.time.Duration (periods).

Time-related Utility Functions

This namespace contains utility functions for working with time objects,
built on java.time.Instant (timestamps) and java.time.Duration (periods).
raw docstring

after?clj

(after? a b)
source

agoclj

(ago d)
source

attempt-date-time-parseclj

(attempt-date-time-parse formatter timestamp-str)

Inputs: [formatter :- DateTimeFormatter timestamp-str :- String]

Parses timestamp-str using formatter. Returns nil if parsing fails.

Inputs: [formatter :- DateTimeFormatter timestamp-str :- String]

Parses `timestamp-str` using `formatter`. Returns nil if parsing fails.
sourceraw docstring

before?clj

(before? a b)
source

date-timeclj

(date-time year month day)
(date-time year month day hour)
(date-time year month day hour minute)
(date-time year month day hour minute second)
(date-time year month day hour minute second millis)

Construct an Instant from year/month/day/hour/minute/second/millis (all UTC).

Construct an Instant from year/month/day/hour/minute/second/millis (all UTC).
sourceraw docstring

date-time?clj

(date-time? x)
source

daysclj

(days n)
source

ephemeral-now-nsclj

(ephemeral-now-ns)

Returns the current time as signed integer nanoseconds with respect to some ephemeral time line. Values are only comparable within the same process, and the range of values may be limited, but differences between successive calls within no more than 250 years of each other will be correct.

Returns the current time as *signed* integer nanoseconds with respect
to some ephemeral time line.  Values are only comparable within the
same process, and the range of values may be limited, but
differences between successive calls within no more than 250 years
of each other will be correct.
sourceraw docstring

equal?clj

(equal? a b)
source

format-periodclj

(format-period p)

Convert a Duration into a human-readable String, e.g. '2 minutes'. Normalizes to the largest clean unit.

Convert a Duration into a human-readable String, e.g. '2 minutes'.
Normalizes to the largest clean unit.
sourceraw docstring

from-longclj

(from-long n)
source

from-nowclj

(from-now d)
source

from-sql-dateclj

(from-sql-date ts)
source

hoursclj

(hours n)
source

intervalclj

(interval start end)

Returns the Duration between two Instants.

Returns the Duration between two Instants.
sourceraw docstring

millisclj

(millis n)
source

minusclj

(minus t d)
source

minutesclj

(minutes n)
source

nowclj

(now)
source

parse-iso-zclj

(parse-iso-z s)

Returns a pdb instant (UTC timestamp) if s represents an ISO formatted timestamp like "2011-12-03T10:15:30Z" or nil.

Returns a pdb instant (UTC timestamp) if s represents an ISO
formatted timestamp like "2011-12-03T10:15:30Z" or nil.
sourceraw docstring

parse-offset-isoclj

Returns a pdb instant (UTC timestamp) if s represents an ISO formatted timestamp with offset like "2011-12-03T10:15:30+01:00" or nil.

Returns a pdb instant (UTC timestamp) if s represents an ISO
formatted timestamp with offset like "2011-12-03T10:15:30+01:00"
or nil.
sourceraw docstring

parse-periodclj

(parse-period s)

Parse a String into a Duration. Supported suffixes: d, h, m, s, ms. For example, (parse-period "2d") returns a Duration of 2 days.

Parse a String into a Duration. Supported suffixes: d, h, m, s, ms.
For example, (parse-period "2d") returns a Duration of 2 days.
sourceraw docstring

period-longer?clj

(period-longer? d1 d2)

Returns true if d1 is longer than d2.

Returns true if d1 is longer than d2.
sourceraw docstring

period?clj

(period? x)
source

periods-equal?clj

(periods-equal? _p)
(periods-equal? p1 p2)
(periods-equal? p1 p2 & more)

Returns true if all given Durations represent the same amount of time.

Returns true if all given Durations represent the same amount of time.
sourceraw docstring

plusclj

(plus t d)
source

secondsclj

(seconds n)
source

to-date-timeclj

(to-date-time x)

Coerce x to an Instant. Accepts strings, longs, java.sql.Timestamps, and Instants.

Coerce x to an Instant. Accepts strings, longs, java.sql.Timestamps, and Instants.
sourceraw docstring

to-daysclj

(to-days d)
source

to-hoursclj

(to-hours d)
source

to-longclj

(to-long t)

Convert a timestamp to epoch milliseconds.

Convert a timestamp to epoch milliseconds.
sourceraw docstring

to-millisclj

(to-millis d)
source

to-minutesclj

(to-minutes d)
source

to-secondsclj

(to-seconds d)
source

to-stringclj

(to-string t)

Convert a timestamp to ISO-8601 string with mandatory millisecond precision. Accepts Instant, java.sql.Timestamp, or String (parsed and reformatted to normalize timezone offset and precision).

Convert a timestamp to ISO-8601 string with mandatory millisecond precision.
Accepts Instant, java.sql.Timestamp, or String (parsed and reformatted to
normalize timezone offset and precision).
sourceraw docstring

to-timestampclj

(to-timestamp ts)

Inputs: [ts] Returns: (s/maybe java.sql.Timestamp)

Convert to a java.sql.Timestamp. When ts is a String, attempts parsing with likely date formats first.

Inputs: [ts]
Returns: (s/maybe java.sql.Timestamp)

Convert to a java.sql.Timestamp. When `ts` is a String, attempts
parsing with likely date formats first.
sourceraw docstring

ToJavaDatecljprotocol

to-java-dateclj

(to-java-date x)

Converts x to a java.util.Date.

Converts x to a java.util.Date.
source

truncate-to-dayclj

(truncate-to-day t)

Truncate an Instant to the start of the day (UTC).

Truncate an Instant to the start of the day (UTC).
sourceraw docstring

wire-datetime->instantclj

(wire-datetime->instant s)

Parses s as a PuppetDB wire format <datetime> and returns an Instant, or nil if the string cannot be parsed.

Parses s as a PuppetDB wire format <datetime> and returns an
Instant, or nil if the string cannot be parsed.
sourceraw docstring

wire-datetime?clj

(wire-datetime? s)
source

wire-format-formatterclj

source

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