time — Time utilities
A small time module exposing convenience types and functions. This
module provides lightweight wrappers over Python's time and
datetime functionality and introduces TimeDelta, Time, Date,
DateTime, and Timezone helper classes.
Constants
MINYEAR,MAXYEAR,UTC
Types
TimeDelta— duration wrapper (days, seconds, microseconds)Time— time-of-day helper withnow()and propertiesDate— date helper withtoday(),fromtimestamp(),fromisoformat()DateTime— full datetime wrapper withnow(),utcnow(),fromtimestamp()Timezone— simple timezone object withutcoffset()
Functions
sleep(seconds: float) -> Nonetime() -> float— epoch secondsmonotonic() -> floatperf_counter() -> floatstrftime(format: str, timestamp: float) -> strstrptime(date_string: str, format: str) -> struct_timenow() -> float— timestamp nowformat(timestamp: float) -> str— ISO-formatted string (UTC)today() -> datefromtimestamp(timestamp: float) -> DateTimeutcnow() -> DateTimeisoformat(dt_obj: DateTime) -> str
Examples
function example() returns null {
print(time.time());
print(time.strftime("%Y-%m-%d", time.time()));
let dt = time.now();
print(time.isoformat(dt));
}
Notes & compatibility
- This module is marked experimental in-source — for production-grade
date/time handling prefer using
pyimport datetimedirectly. ping-style behavior and timezone handling can vary between OSes and Python versions.