An instant, stored losslessly as whole seconds since 1970-01-01T00:00:00 plus a normalized nanosecond-of-second part (always 0..999999999, also for pre-epoch instants). Holds any Parquet TIMESTAMP unit exactly over the full int64 range of the stored value. Timezone-agnostic: holds the stored epoch offset verbatim. A default-initialized element is null.
Constructs a valid parquet_timestamp, either from full civil fields (year, month, day, hour, minute, second[, nanosecond]) -- aborting on invalid fields -- or from a (parquet_date, parquet_time) pair, where a null input propagates to a null result.
Civil-fields constructor specific for the parquet_timestamp generic; aborts on invalid fields.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | year |
calendar year. |
||
| integer(kind=int32), | intent(in) | :: | month |
month, 1..12. |
||
| integer(kind=int32), | intent(in) | :: | day |
day of month. |
||
| integer(kind=int32), | intent(in) | :: | hour |
hour, 0..23. |
||
| integer(kind=int32), | intent(in) | :: | minute |
minute, 0..59. |
||
| integer(kind=int32), | intent(in) | :: | second |
second, 0..59. |
||
| integer(kind=int32), | intent(in), | optional | :: | nanosecond |
sub-second part, 0..999999999 (default 0). |
the constructed element (valid).
Date-plus-time constructor specific for the parquet_timestamp generic; a null input propagates to a null result (never aborts).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(parquet_date), | intent(in) | :: | date |
the calendar-date part. |
||
| type(parquet_time), | intent(in) | :: | time |
the time-of-day part. |
the constructed element (null if an input is null).
Sets from civil fields or a date + time pair.
Civil-fields specific of the set generic: sets the element from (year, month, day, hour, minute, second[, nanosecond]), validated; marks it valid.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(inout) | :: | self |
receives the instant (marked valid). |
||
| integer(kind=int32), | intent(in) | :: | year |
calendar year. |
||
| integer(kind=int32), | intent(in) | :: | month |
month, 1..12. |
||
| integer(kind=int32), | intent(in) | :: | day |
day of month. |
||
| integer(kind=int32), | intent(in) | :: | hour |
hour, 0..23. |
||
| integer(kind=int32), | intent(in) | :: | minute |
minute, 0..59. |
||
| integer(kind=int32), | intent(in) | :: | second |
second, 0..59. |
||
| integer(kind=int32), | intent(in), | optional | :: | nanosecond |
sub-second part, 0..999999999 (default 0). |
Date-plus-time specific of the set generic: combines a parquet_date and a parquet_time into an instant. A null input propagates: the result is null (never aborts).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(out) | :: | self |
receives the instant (or null if an input is null). |
||
| type(parquet_date), | intent(in) | :: | date |
the calendar-date part. |
||
| type(parquet_time), | intent(in) | :: | time |
the time-of-day part. |
Returns all civil fields (aborts on null).
Returns all civil fields of the element; aborts on a null element, and on a year outside the integer(int32) range (practically unreachable for real data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the element. |
||
| integer(kind=int32), | intent(out) | :: | year |
calendar year. |
||
| integer(kind=int32), | intent(out) | :: | month |
month, 1..12. |
||
| integer(kind=int32), | intent(out) | :: | day |
day of month. |
||
| integer(kind=int32), | intent(out) | :: | hour |
hour, 0..23. |
||
| integer(kind=int32), | intent(out) | :: | minute |
minute, 0..59. |
||
| integer(kind=int32), | intent(out) | :: | second |
second, 0..59. |
||
| integer(kind=int32), | intent(out), | optional | :: | nanosecond |
sub-second part, 0..999999999. |
The date part; null propagates (never aborts).
Returns the calendar-date part as a parquet_date. A null element propagates to a null result (never aborts on null); aborts only if the date falls outside parquet_date's representable range (practically unreachable for real data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the element. |
the date part (null if the element is null).
The time-of-day part; null propagates (never aborts).
Returns the time-of-day part as a parquet_time. A null element propagates to a null result (never aborts).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the element. |
the time-of-day part (null if the element is null).
Whether the element is null (never aborts).
Returns whether the element is null (the primary null guard; never aborts).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the element. |
Marks the element null.
Marks the element null.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(inout) | :: | self |
the element (reset to the null state). |
Sets the raw (seconds, nanoseconds) pair (interop).
Sets the raw (seconds, nanoseconds) pair directly (interop/advanced accessor; marks the element valid); aborts on a nanosecond part outside the normalized 0..999999999 range.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(inout) | :: | self |
receives the value (marked valid). |
||
| integer(kind=int64), | intent(in) | :: | seconds |
whole seconds since 1970-01-01T00:00:00. |
||
| integer(kind=int32), | intent(in) | :: | nanoseconds |
nanosecond-of-second part, 0..999999999. |
Raw (seconds, nanoseconds); zeros when null (interop).
Returns the raw (seconds, nanoseconds) pair, or zeros for a null element (interop/advanced accessor; never aborts -- validity travels separately via is_null).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the element. |
||
| integer(kind=int64), | intent(out) | :: | seconds |
whole seconds since 1970-01-01T00:00:00 (0 when null). |
||
| integer(kind=int32), | intent(out) | :: | nanoseconds |
nanosecond-of-second part (0 when null). |
Sets from a Unix-time value in a given unit.
int32 specific of set_unix; see ts_set_unix_i64.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(inout) | :: | self |
receives the value (marked valid). |
||
| integer(kind=int32), | intent(in) | :: | value |
Unix time in |
||
| integer, | intent(in) | :: | unit |
one of the parquet_unit_* constants. |
int64 specific of set_unix: sets the element from a Unix-time value -- value counts
time since 1970-01-01T00:00:00 in unit. The unit is a conversion parameter only; it
is not stored (the internal representation is always the canonical seconds+nanoseconds
pair). Always exact; marks the element valid.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(inout) | :: | self |
receives the value (marked valid). |
||
| integer(kind=int64), | intent(in) | :: | value |
Unix time in |
||
| integer, | intent(in) | :: | unit |
one of the parquet_unit_* constants. |
Unix-time value in a given unit (aborts on null/loss).
Returns the element as a single Unix-time integer in unit -- a pure query, never
modifying the element. Aborts on a null element, on int64 overflow in the requested
unit, and on precision loss (the value carries sub-unit precision) unless
exact=.false., which floors toward negative infinity instead (floor, not truncation,
so ordering is preserved across the epoch).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the element (unchanged). |
||
| integer, | intent(in) | :: | unit |
one of the parquet_unit_* constants. |
||
| logical, | intent(in), | optional | :: | exact |
default .true.; .false. => floor instead of abort. |
Sets from a real64 Modified Julian Date.
Sets the element from a real64 Modified Julian Date (MJD 0 = 1858-11-17T00:00:00), rounding to the nearest nanosecond; marks it valid. Aborts on NaN or a magnitude beyond the representable range. real64 only by design -- real32 would silently lose precision (consecutive real32 values around a present-day MJD are ~340 s apart) and is deliberately not accepted.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(inout) | :: | self |
receives the instant (marked valid). |
||
| real(kind=real64), | intent(in) | :: | mjd |
Modified Julian Date (fractional days). |
real64 Modified Julian Date (aborts on null).
Returns the element as a real64 Modified Julian Date; aborts on a null element. Resolution is limited by real64: ~1 microsecond in the current era -- for exact nanosecond round-trips use the civil fields or set_unix/to_unix instead.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the element. |
Sets from a real64 Julian Date.
Sets the element from a real64 Julian Date (JD = MJD + 2400000.5); same rounding, range and real64-only rationale as set_mjd. Note the coarser real64 resolution at JD magnitudes (~50 microseconds in the current era).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(inout) | :: | self |
receives the instant (marked valid). |
||
| real(kind=real64), | intent(in) | :: | jd |
Julian Date (fractional days). |
real64 Julian Date (aborts on null).
Returns the element as a real64 Julian Date (JD = MJD + 2400000.5); aborts on a null element. Resolution ~50 microseconds in the current era (real64 at JD magnitudes) -- prefer to_mjd, the civil fields, or to_unix when that matters.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the element. |
ISO-8601 "YYYY-MM-DDTHH:MM:SS[.fraction]" (aborts on null).
Writes the element as ISO-8601 "YYYY-MM-DDTHH:MM:SS[.fraction]" (year formatting as in parquet_date%to_string; fraction as in parquet_time%to_string); aborts on a null element. A subroutine for the same reason as parquet_date%to_string.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the element. |
||
| character(len=:), | intent(out), | allocatable | :: | str |
receives the formatted date-time. |
Sets from an ISO-8601 date-time string.
Sets the element from an ISO-8601 date-time string
"[-]YYYY-MM-DD{T or space}HH:MM:SS[.fraction][Z]" (an optional trailing 'Z' is accepted
and ignored -- values are stored as epoch offsets regardless). Failure handling matches
parquet_date%parse: abort by default, or report via the optional success (leaving the
element null).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(out) | :: | self |
receives the parsed instant (or null on caught failure). |
||
| character(len=*), | intent(in) | :: | str |
ISO-8601 date-time string. |
||
| logical, | intent(out), | optional | :: | success |
.true. on success; absent => abort on failure. |
Equality (aborts on a null operand).
Equality specific; see the operator(==) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | a |
left operand. |
||
| class(parquet_timestamp), | intent(in) | :: | b |
right operand. |
Inequality (aborts on a null operand).
Inequality specific; see the operator(/=) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | a |
left operand. |
||
| class(parquet_timestamp), | intent(in) | :: | b |
right operand. |
Ordering (aborts on a null operand).
Less-than specific; see the operator(<) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | a |
left operand. |
||
| class(parquet_timestamp), | intent(in) | :: | b |
right operand. |
Ordering (aborts on a null operand).
Less-or-equal specific; see the operator(<=) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | a |
left operand. |
||
| class(parquet_timestamp), | intent(in) | :: | b |
right operand. |
Ordering (aborts on a null operand).
Greater-than specific; see the operator(>) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | a |
left operand. |
||
| class(parquet_timestamp), | intent(in) | :: | b |
right operand. |
Ordering (aborts on a null operand).
Greater-or-equal specific; see the operator(>=) generic. Aborts on a null operand.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | a |
left operand. |
||
| class(parquet_timestamp), | intent(in) | :: | b |
right operand. |
Real64-seconds difference (ts, ts); never aborts on magnitude.
Type-bound diff_seconds: real64-seconds difference between two instants. Unlike operator(-) (ts_diff_ns), this never aborts on magnitude -- only precision is lost at extreme elapsed times, matching real64's own resolution. Aborts on a null operand. Each operand's seconds component is converted to real64 before subtracting (rather than subtracting as int64 first) -- two instants near opposite ends of the int64 range would overflow an int64 subtraction, whereas real64 subtraction only loses precision, matching this function's own "never aborts on magnitude" contract.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | a |
left (later) operand. |
||
| class(parquet_timestamp), | intent(in) | :: | b |
right (earlier) operand. |
Difference or ns offset (aborts on a null operand or int64 overflow).
Difference specific; see the operator(-) generic. Nanoseconds, exact; aborts on a null operand and when the elapsed time exceeds ~292.3 years (TS_DIFF_NS_BOUND_SECONDS) -- the bound is checked on the seconds component alone, without ever forming an intermediate value that could itself overflow int64, so the "too far apart to represent" case is detected before any arithmetic that could silently wrap.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | a |
left (later) operand. |
||
| class(parquet_timestamp), | intent(in) | :: | b |
right (earlier) operand. |
int32 specific of operator(-); see ts_offset_ns_impl.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the instant to shift. |
||
| integer(kind=int32), | intent(in) | :: | n |
ns to subtract. |
self shifted back by n ns.
int64 specific of operator(-); see ts_offset_ns_impl.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the instant to shift. |
||
| integer(kind=int64), | intent(in) | :: | n |
ns to subtract. |
self shifted back by n ns.
Ns offset (aborts on a null operand or int64 overflow).
int32 specific of operator(+); see ts_offset_ns_impl.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the instant to shift. |
||
| integer(kind=int32), | intent(in) | :: | n |
ns to add. |
self shifted forward by n ns.
int64 specific of operator(+); see ts_offset_ns_impl.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parquet_timestamp), | intent(in) | :: | self |
the instant to shift. |
||
| integer(kind=int64), | intent(in) | :: | n |
ns to add. |
self shifted forward by n ns.
type :: parquet_timestamp private integer(int64) :: seconds = 0_int64 !! whole seconds since 1970-01-01T00:00:00. integer(int32) :: nanoseconds = 0_int32 !! nanosecond-of-second part, always 0..999999999. logical :: valid = .false. !! .false. = null element (the default state). contains procedure, private :: ts_set_civil !! (year, month, day, hour, minute, second[, ns]) specific. procedure, private :: ts_set_date_time !! (parquet_date, parquet_time) specific; null propagates. generic :: set => ts_set_civil, ts_set_date_time !! Sets from civil fields or a date + time pair. procedure :: get => ts_get !! Returns all civil fields (aborts on null). procedure :: get_date => ts_get_date !! The date part; null propagates (never aborts). procedure :: get_time => ts_get_time !! The time-of-day part; null propagates (never aborts). procedure :: is_null => ts_is_null !! Whether the element is null (never aborts). procedure :: set_null => ts_set_null !! Marks the element null. procedure :: set_raw => ts_set_raw !! Sets the raw (seconds, nanoseconds) pair (interop). procedure :: get_raw => ts_get_raw !! Raw (seconds, nanoseconds); zeros when null (interop). procedure, private :: ts_set_unix_i32 !! int32 specific of set_unix. procedure, private :: ts_set_unix_i64 !! int64 specific of set_unix. generic :: set_unix => ts_set_unix_i32, ts_set_unix_i64 !! Sets from a Unix-time value in a given unit. procedure :: to_unix => ts_to_unix !! Unix-time value in a given unit (aborts on null/loss). procedure :: set_mjd => ts_set_mjd !! Sets from a real64 Modified Julian Date. procedure :: to_mjd => ts_to_mjd !! real64 Modified Julian Date (aborts on null). procedure :: set_jd => ts_set_jd !! Sets from a real64 Julian Date. procedure :: to_jd => ts_to_jd !! real64 Julian Date (aborts on null). procedure :: to_string => ts_to_string !! ISO-8601 "YYYY-MM-DDTHH:MM:SS[.fraction]" (aborts on null). procedure :: parse => ts_parse !! Sets from an ISO-8601 date-time string. procedure, private :: ts_eq !! == specific. procedure, private :: ts_ne !! /= specific. procedure, private :: ts_lt !! < specific. procedure, private :: ts_le !! <= specific. procedure, private :: ts_gt !! > specific. procedure, private :: ts_ge !! >= specific. generic :: operator(==) => ts_eq !! Equality (aborts on a null operand). generic :: operator(/=) => ts_ne !! Inequality (aborts on a null operand). generic :: operator(<) => ts_lt !! Ordering (aborts on a null operand). generic :: operator(<=) => ts_le !! Ordering (aborts on a null operand). generic :: operator(>) => ts_gt !! Ordering (aborts on a null operand). generic :: operator(>=) => ts_ge !! Ordering (aborts on a null operand). procedure, private :: ts_diff_ns !! (ts, ts) specific of operator(-): ns difference. procedure :: diff_seconds => ts_diff_seconds !! Real64-seconds difference (ts, ts); never aborts on magnitude. procedure, private :: ts_sub_ns_i32 !! (ts, integer(int32)) specific of operator(-). procedure, private :: ts_sub_ns_i64 !! (ts, integer(int64)) specific of operator(-). procedure, private :: ts_add_ns_i32 !! (ts, integer(int32)) specific of operator(+). procedure, private :: ts_add_ns_i64 !! (ts, integer(int64)) specific of operator(+). generic :: operator(-) => ts_diff_ns, ts_sub_ns_i32, ts_sub_ns_i64 !! Difference or ns offset (aborts on a null operand or int64 overflow). generic :: operator(+) => ts_add_ns_i32, ts_add_ns_i64 !! Ns offset (aborts on a null operand or int64 overflow). end type parquet_timestamp