Version: dev

timestamp_to_seconds

Stable function · Other

Tier: stable · Kind: function · Topic: Other

JuliaTypeScriptPythonRustGo
timestamp_to_secondsnot exportedtimestamp_to_secondstimestamp_to_secondsnot exported

Julia

timestamp_to_seconds(file::EsmFile, timestamp::AbstractString)
timestamp_to_seconds(file::EsmFile, timestamp)
timestamp_to_seconds(file::EsmFile, timestamp) -> Float64

timestamp, an RFC 3339 UTC timestamp (YYYY-MM-DDThh:mm:ss[.f]Z — the solver.time_span bound form), as seconds from file’s time origin: (W − W₀) + (f − f₀), the whole-second difference in integers and then the fractions in binary64, exactly as resolve_time_span converts a time_span timestamp (esm-spec §2.2.7). The origin is time_origin(file) .

Raises solver_time_span_invalid when timestamp is not a string, is not of that form, or names no calendar day, or when the document’s origin cannot be read. The timestamp is checked before the origin, so the two errors — which share a code — are reported in the same order as in the other bindings.

Source

TypeScript

TypeScript does not export this function.

Python

timestamp_to_seconds(esm_file: EsmFile, timestamp: str) -> float

timestamp as seconds from esm_file’s time origin (esm-spec §2.2.7).

timestamp is an RFC 3339 UTC timestamp (YYYY-MM-DDThh:mm:ss[.f]Z, the solver.time_span bound form). The result is (W - W0) + (f - f0): the whole-second difference in integers, then the fractions added in binary64 – exactly what resolve_time_span does to a time_span timestamp. The origin is time_origin .

Raises solver_time_span_invalid when timestamp is not of that form or names no calendar day, or when the document’s origin cannot be read. The timestamp is checked BEFORE the origin, so the two errors a caller cannot tell apart by code are still reported in the same order in every binding.

Source

Rust

pub fn timestamp_to_seconds(file: &EsmFile, timestamp: &str) -> Result<f64, DiagnosticError>

timestamp as seconds from file’s time origin (esm-spec §2.2.7).

timestamp is an RFC 3339 UTC timestamp (YYYY-MM-DDThh:mm:ss[.f]Z, the solver.time_span bound form). The result is (W - W0) + (f - f0): the whole-second difference in integers, then the fractions added in binary64, exactly as resolve_time_span converts a time_span timestamp. The origin is time_origin .

Fails with solver_time_span_invalid when timestamp is not of that form or names no calendar day, or when the document’s origin cannot be read. The timestamp is checked BEFORE the origin, so the two errors – which share a code – are reported in the same order as in Julia and Python.

Source · Rust docs

Go

Go does not export this function.