Skip to main content

Module temporal

Module temporal 

Source
Expand description

Deterministic temporal computation for AI agents.

Provides pure functions for timezone conversion, duration computation, timestamp adjustment, and relative datetime resolution. All functions take explicit inputs (no system clock access) — the caller provides the “now” anchor when needed, keeping these functions testable and WASM-compatible.

§Design Principle

These functions replace LLM inference with deterministic computation. If an expression cannot be parsed unambiguously, we return an error rather than guessing — the opposite of what LLMs do.

§Functions

§Datetime Accuracy

When used via the MCP server, the “now” anchor comes from chrono::Utc::now(), which reads the OS kernel clock (NTP-synchronized on modern systems, typically <50ms accuracy). No online time service is used.

Structs§

AdjustedTimestamp
The result of adjusting a timestamp by a duration.
ConvertedDatetime
The result of converting a datetime to a target timezone.
DurationInfo
Duration information between two timestamps.
ResolvedDatetime
The result of resolving a relative time expression.

Functions§

adjust_timestamp
Adjust a timestamp by adding or subtracting a duration.
compute_duration
Compute the duration between two timestamps.
convert_timezone
Convert a datetime string to a different timezone representation.
resolve_relative
Resolve a relative time expression to an absolute datetime.