Tea
DocsPlaygroundExamplesReferenceCommunity
GitHub

Tea Language

A strongly typed scripting language for native tools.

© 2026 Tea Language.

ContributingCommunityRepository

Language Runtime

Built-ins

Standard Library

std.argsstd.assertstd.audiostd.envstd.fsstd.httpstd.netstd.jsonstd.parsestd.pathstd.processstd.regexstd.stringstd.timestd.url

Standard Library

std.time

Time helpers for tool-style scripts.

Exported functions

pub def now() -> Timestamp

Return the current UTC timestamp.

pub def now_unix_seconds() -> Int

Return the current Unix timestamp in seconds.

pub def now_unix_millis() -> Int

Return the current Unix timestamp in milliseconds.

pub def sleep(delay_ms: Int) -> Void

Pause the current thread for the specified number of milliseconds.

pub def sleep_for(duration: Duration) -> Void

Pause the current thread for a duration value.

pub def from_unix_seconds(value: Int) -> Timestamp

Construct a timestamp from Unix seconds.

pub def from_unix_millis(value: Int) -> Timestamp

Construct a timestamp from Unix milliseconds.

pub def unix_seconds(timestamp: Timestamp) -> Int

Return the Unix seconds for a timestamp.

pub def unix_millis(timestamp: Timestamp) -> Int

Return the Unix milliseconds for a timestamp.

pub def milliseconds(value: Int) -> Duration

Create a duration in milliseconds.

pub def seconds(value: Int) -> Duration

Create a duration in seconds.

pub def minutes(value: Int) -> Duration

Create a duration in minutes.

pub def hours(value: Int) -> Duration

Create a duration in hours.

pub def days(value: Int) -> Duration

Create a duration in days.

pub def add(left: Duration, right: Duration) -> Duration

Return the sum of two durations.

pub def subtract(left: Duration, right: Duration) -> Duration

Return the difference between two durations.

pub def multiply(duration: Duration, factor: Int) -> Duration

Multiply a duration by an integer factor.

pub def between(start: Timestamp, finish: Timestamp) -> Duration

Return the elapsed duration between two timestamps.

pub def add_to(timestamp: Timestamp, duration: Duration) -> Timestamp

Add a duration to a timestamp.

pub def subtract_from(timestamp: Timestamp, duration: Duration) -> Timestamp

Subtract a duration from a timestamp.

pub def format_rfc3339(timestamp: Timestamp) -> String

Format a timestamp as an RFC3339 string in UTC.

pub def try_parse_rfc3339(text: String) -> Timestamp ! TimeError

Parse an RFC3339 string into a timestamp.

pub def parse_rfc3339(text: String) -> Timestamp

Parse an RFC3339 string and panic on invalid input.