Froth, and this site, are pre-alpha. This site is largely OSAI-generated documentation from the Froth repo.

Timing words are target-facing because they depend on the platform. ESP32 uses the board/RTOS delay path. POSIX uses host-side sleep.

Words

ms: (durationMs) -> nil

Blocks for the requested number of milliseconds.

ms: 75

Use it for simple sketches, not hard real-time scheduling. While ms is running, no other Froth code in that evaluation proceeds.

millis: () -> Int

Returns wrapped monotonic uptime in milliseconds.

millis:

Use millis for elapsed-time checks when a loop should keep control:

blink.last is 0

to blink.poll [
  when ((millis:) - blink.last) > 250 [
    led.toggle:;
    set blink.last to millis:
  ]
]

Relationship To Utilities

The Utilities page lists timing alongside random and math helpers because those words often appear together in Machine sketches. This page is the low-level timing contract.