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) -> None
time() -> float
— epoch secondsmonotonic() -> float
perf_counter() -> float
strftime(format: str, timestamp: float) -> str
strptime(date_string: str, format: str) -> struct_time
now() -> float
— timestamp nowformat(timestamp: float) -> str
— ISO-formatted string (UTC)today() -> date
fromtimestamp(timestamp: float) -> DateTime
utcnow() -> DateTime
isoformat(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 datetime
directly. ping
-style behavior and timezone handling can vary between OSes and Python versions.