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
convert_timezone— Convert a datetime between timezone representationscompute_duration— Calculate the duration between two timestampsadjust_timestamp— Add or subtract a duration from a timestampresolve_relative— Resolve a relative time expression to an absolute datetime
§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§
- Adjusted
Timestamp - The result of adjusting a timestamp by a duration.
- Converted
Datetime - The result of converting a datetime to a target timezone.
- Duration
Info - Duration information between two timestamps.
- Resolved
Datetime - 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.