Complete offset-bearing timestamps, rfc3339-microseconds-rfc9557-base-v1.
RFC 3339 sections 5.6–5.8 with RFC 9557 section 2 offset semantics.
Four-digit astronomical Gregorian years 0000–9999, required seconds and
zero through six supplied fractional digits. This is an instant declaration,
not a calendar selection of the supplied precision's width.
Z and -00:00 both mean UTC is known without asserting a local offset;
canonical output uses Z. Numeric +00:00 retains its assertion. Lowercase
t/z are accepted and emitted uppercase. Fractional width is preserved:
.12 and .120 denote the same position but are distinct declarations.
Incomplete prefixes have valid completed fields; unfinished digit fields are
checked syntactically. A trailing [ after a complete base timestamp recognizes
excluded annotations without validating their grammar.
Leap seconds, fractions beyond six digits and IXDTF annotations are explicitly
unsupported. No rounding, zone lookup, implicit clock or full ISO claim.
Parsing checks a 256-byte limit before streaming into scalar fields, without
materializing a byte list. Construction, conversion and
formatting have constant bounded work. Canonical standard text can be stored directly.
parser_for : encoding -> (state -> Try({ value : OffsetTimestamp, rest : state }, [InvalidOffsetTimestamp(Error), Encoding(err), ..]))
where [
encoding.parse_str : encoding, state -> Try({ value : Str, rest : state }, err),
]
Decode one encoded string using this type's text parser.
Encoding failures remain distinct from this profile's validation errors.
The encoding owns framing and its work limits; parse bounds the decoded text.
encoder_for : encoding -> (OffsetTimestamp, state -> Try(state, err))
where [
encoding.encode_str : Str, state -> Try(state, err),
]
Encodes the canonical standard text as a string in the selected encoding; encoding failures pass through.
Checks a four-digit Gregorian timestamp declaration, exact fractional width 0–6, and whole-minute numeric offset within +/-23:59. Precision loss is rejected.
Validated fields need at most 32 ASCII bytes: 19 fixed, 7 fractional,
and 6 for an asserted offset. Build one owned buffer rather than padded
temporary strings. Formatting preserves supplied width and offset intent.