Liking cljdoc? Tell your friends :D

openadr3.vtn.time

Time helpers for the VTN.

The VTN's internal canon is java.time.ZonedDateTime for any datetime value (createdDateTime, modificationDateTime, intervalPeriod.start) and java.time.Duration for any duration value (intervalPeriod.duration). All zone-sensitive arithmetic happens on ZonedDateTime so DST is handled correctly by the IANA rules.

At the wire boundary (HTTP response, MQTT publish, DDB :data attribute, and the DDB :eventStart GSI key) datetimes are serialised to canonical UTC Z form via zdt->utc-z. The OA3 spec strongly conventionalises Z form, and the GSI relies on lex-orderable sort keys, so canonicalising the wire keeps both consistent.

Inbound parsing accepts arbitrary RFC 3339 offsets (Z, +00:00, -07:00, …) and the VTN-RI's non-standard space-separated form.

Time helpers for the VTN.

The VTN's internal canon is `java.time.ZonedDateTime` for any datetime
value (createdDateTime, modificationDateTime, intervalPeriod.start) and
`java.time.Duration` for any duration value (intervalPeriod.duration).
All zone-sensitive arithmetic happens on `ZonedDateTime` so DST is
handled correctly by the IANA rules.

At the wire boundary (HTTP response, MQTT publish, DDB :data attribute,
and the DDB :eventStart GSI key) datetimes are serialised to canonical
UTC `Z` form via `zdt->utc-z`. The OA3 spec strongly conventionalises Z
form, and the GSI relies on lex-orderable sort keys, so canonicalising
the wire keeps both consistent.

Inbound parsing accepts arbitrary RFC 3339 offsets (`Z`, `+00:00`,
`-07:00`, …) and the VTN-RI's non-standard space-separated form.
raw docstring

duration->isoclj

(duration->iso d)

Format a Duration as its ISO 8601 string (PT1H, PT15M, …).

Format a Duration as its ISO 8601 string (`PT1H`, `PT15M`, …).
sourceraw docstring

now-utc-zclj

(now-utc-z)

Current instant as a canonical UTC Z ISO 8601 string. Convenience wrapper.

Current instant as a canonical UTC Z ISO 8601 string. Convenience wrapper.
sourceraw docstring

now-zdtclj

(now-zdt)

Current instant as a UTC ZonedDateTime.

Current instant as a UTC ZonedDateTime.
sourceraw docstring

parse-durationclj

(parse-duration s)

Parse an ISO 8601 duration string to a java.time.Duration.

Parse an ISO 8601 duration string to a java.time.Duration.
sourceraw docstring

parse-duration-maybeclj

(parse-duration-maybe s)

Parse to Duration if s is a non-blank string; pass through nil and already-parsed Duration values.

Parse to Duration if `s` is a non-blank string; pass through nil and
already-parsed Duration values.
sourceraw docstring

parse-zdtclj

(parse-zdt s)

Parse an RFC 3339 datetime string to a ZonedDateTime.

Accepts arbitrary offsets per RFC 3339 (Z, +00:00, -07:00, …). The returned ZonedDateTime is zoned to the wire offset (no IANA name is recoverable from the wire).

Also accepts the VTN-RI's non-standard space-separated form (2026-03-08 19:22:06, no offset) by inserting T and assuming UTC.

Parse an RFC 3339 datetime string to a ZonedDateTime.

Accepts arbitrary offsets per RFC 3339 (`Z`, `+00:00`, `-07:00`, …).
The returned ZonedDateTime is zoned to the wire offset (no IANA name
is recoverable from the wire).

Also accepts the VTN-RI's non-standard space-separated form
(`2026-03-08 19:22:06`, no offset) by inserting `T` and assuming UTC.
sourceraw docstring

parse-zdt-maybeclj

(parse-zdt-maybe s)

Parse to ZonedDateTime if s is a non-blank string; pass through nil and already-parsed ZonedDateTime values.

Parse to ZonedDateTime if `s` is a non-blank string; pass through nil
and already-parsed ZonedDateTime values.
sourceraw docstring

plus-daysclj

(plus-days zdt n)

Add n calendar days to a ZonedDateTime, respecting the zone's DST rules.

Add n calendar days to a ZonedDateTime, respecting the zone's DST rules.
sourceraw docstring

zdt->utc-zclj

(zdt->utc-z zdt)

Format a ZonedDateTime as canonical UTC Z ISO 8601 (2026-05-03T07:00:00Z). Normalises to UTC regardless of the zone the value carries — this is the wire form for OA3 and the canonical form for the DDB :eventStart GSI.

Format a ZonedDateTime as canonical UTC Z ISO 8601 (`2026-05-03T07:00:00Z`).
Normalises to UTC regardless of the zone the value carries — this is the
wire form for OA3 and the canonical form for the DDB :eventStart GSI.
sourceraw 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