Liking cljdoc? Tell your friends :D

puppetlabs.puppetdb.time

Time-related Utility Functions

This namespace contains some utility functions for working with objects related to time; it is mostly based off of the Period class from Java's JodaTime library.

Time-related Utility Functions

This namespace contains some utility functions for working with objects
related to time; it is mostly based off of the `Period` class from
Java's JodaTime library.
raw docstring

after?clj

source

agoclj

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 an Exception is thrown, otherwise the parsed DateTime object

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

Parses `timestamp-str` using `formatter`. Returns nil if an
Exception is thrown, otherwise the parsed DateTime object
sourceraw docstring

before?clj

source

date-timeclj

source

date-time?clj

(date-time? x)
source

day-formatterclj

A formatter that converts Day Period objects to strings formatted as, e.g., '2 days'.

A formatter that converts Day `Period` objects to strings formatted as, e.g.,
'2 days'.
sourceraw docstring

day-parserclj

A parser that matches strings ending with d and returns a Period of days

A parser that matches strings ending with `d` and returns a `Period` of days
sourceraw docstring

daysclj

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

source

format-periodclj

(format-period p)

Convert a Period object into a human-readable String; e.g.:

`(format-period (clj-time.core/seconds 120))`

returns '2 minutes'. The Period will only be normalized to the largest round unit; e.g., a Period of 121 seconds will not be normalized to minutes.

Convert a `Period` object into a human-readable String; e.g.:

    `(format-period (clj-time.core/seconds 120))`

returns '2 minutes'.  The `Period` will only be normalized to
the largest round unit; e.g., a `Period` of 121 seconds will
not be normalized to minutes.
sourceraw docstring

formattersclj

source

from-longclj

source

from-nowclj

source

from-sql-dateclj

source

hour-formatterclj

A formatter that converts Hour Period objects to strings formatted as, e.g., '2 hours'.

A formatter that converts Hour `Period` objects to strings formatted as,
e.g., '2 hours'.
sourceraw docstring

hour-parserclj

A parser that matches strings ending with h and returns a Period of hours

A parser that matches strings ending with `h` and returns a `Period` of hours
sourceraw docstring

hoursclj

source

in-millisclj

source

in-minutesclj

source

in-secondsclj

source

intervalclj

source

joda-datetime->java-zoneddatetimeclj

(joda-datetime->java-zoneddatetime date)

Convert a org.joda.time.DateTime object to a java.time.ZonedDateTime

Convert a org.joda.time.DateTime object to a java.time.ZonedDateTime
sourceraw docstring

millisclj

source

millisecond-formatterclj

A formatter that converts Period objects to strings formatted as, e.g., '2 milliseconds'.

A formatter that converts  `Period` objects to strings formatted as, e.g.,
'2 milliseconds'.
sourceraw docstring

millisecond-parserclj

A parser that matches strings ending with ms and returns a Period of milliseconds

A parser that matches strings ending with `ms` and returns a `Period` of
milliseconds
sourceraw docstring

minusclj

source

minute-formatterclj

A formatter that converts Minute Period objects to strings formatted as, e.g., '2 minutes'.

A formatter that converts Minute `Period` objects to strings formatted as,
e.g., '2 minutes'.
sourceraw docstring

minute-parserclj

A parser that matches strings ending with m and returns a Period of minutes

A parser that matches strings ending with `m` and returns a `Period` of minutes
sourceraw docstring

minutesclj

source

nowclj

source

ordered-formattersclj

Like clj-time.format/formatters but ordered with the more likely successful formats first

Like clj-time.format/formatters but ordered with the more likely
successful formats first
sourceraw docstring

parseclj

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 an instance of Period, representing a duration of time. For example, (parse-period "2d") returns a Period representing a duration of 2 days. Currently supported suffixes are 'd', 'h', 'm', 's', and 'ms'.

Parse a String into an instance of `Period`, representing a duration of time.
For example, `(parse-period "2d")` returns a `Period` representing a duration
of 2 days.  Currently supported suffixes are `'d'`, `'h'`, `'m'`, `'s'`, and
`'ms'`.
sourceraw docstring

parse-wire-datetimeclj

(parse-wire-datetime s)

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

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

period-formatterclj

A formatter that converts Period objects to human-readable strings.

A formatter that converts `Period` objects to human-readable strings.
sourceraw docstring

period-longer?clj

(period-longer? p1 p2)

Given two instances of period, return true if the first Period is longer than then second. Uses .toStandardDuration so it will not be affected by daylight savings time, etc

Given two instances of period, return true if the first Period is longer
than then second. Uses .toStandardDuration so it will not be affected by
daylight savings time, etc
sourceraw docstring

period-parserclj

A parser that matches strings ending with d, h, m, s, or ms and returns a Period object representing the specified amount of time.

A parser that matches strings ending with `d`, `h`, `m`, `s`, or `ms` and
returns a `Period` object representing the specified amount of time.
sourceraw docstring

period?clj

(period? p)

Returns true if p is a ReadablePeriod instance, false otherwise.

Returns true if `p` is a ReadablePeriod instance, false otherwise.
sourceraw docstring

periods-equal?clj

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

Given two or more instances of Period, returns true if they all represent the same duration of time (regardless of whether or not they are specified in the same units of time... in other words, the following will return true:

`(periods-equal? (days 2) (hours 48))`

even though this will return false:

`(= (days 2) (hours 48))`
Given two or more instances of `Period`, returns true if they all represent
the same duration of time (regardless of whether or not they are specified in
the same units of time... in other words, the following will return `true`:

    `(periods-equal? (days 2) (hours 48))`

even though this will return `false`:

    `(= (days 2) (hours 48))`
sourceraw docstring

plusclj

source

second-formatterclj

A formatter that converts Second Period objects to strings formatted as, e.g., '2 seconds'.

A formatter that converts Second `Period` objects to strings formatted as,
e.g., '2 seconds'.
sourceraw docstring

second-parserclj

A parser that matches strings ending with s and returns a Period of seconds

A parser that matches strings ending with `s` and returns a `Period` of seconds
sourceraw docstring

secondsclj

source

to-date-timeclj

source

to-daysclj

Given an instance of Period, return an integer representing the number of days

Given an instance of `Period`, return an integer representing the number of days
sourceraw docstring

to-hoursclj

Given an instance of Period, return an integer representing the number of hours

Given an instance of `Period`, return an integer representing the number of hours
sourceraw docstring

to-longclj

source

to-millisclj

Given an instance of Period, return an integer representing the number of milliseconds

Given an instance of `Period`, return an integer representing the number of milliseconds
sourceraw docstring

to-minutesclj

Given an instance of Period, return an integer representing the number of minutes

Given an instance of `Period`, return an integer representing the number of minutes
sourceraw docstring

to-secondsclj

Given an instance of Period, return an integer representing the number of seconds

Given an instance of `Period`, return an integer representing the number of seconds
sourceraw docstring

to-stringclj

source

to-timestampclj

(to-timestamp ts)

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

Delegates to clj-time's to-timestamp, except when ts is a String. When a String, this function will attempt to convert it using a more likely correct date format first (which is faster than to-timestamp's more naive approach)

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

Delegates to clj-time's to-timestamp, except when `ts` is a
String. When a String, this function will attempt to convert it
using a more likely correct date format first (which is faster than
to-timestamp's more naive approach)
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

unparseclj

source

wire-datetime->instantclj

(wire-datetime->instant s)

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

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

wire-datetime?clj

(wire-datetime? s)
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