You’ll run a booking application that reads opening hours and two bookings, then prints the free windows in UTC. You’ll need a Roc compiler and the examples archive from a package release.

Get the examples archive§

Choose a release, download roc-time-examples-<version>.zip and extract it. Install the Roc nightly named in that release’s notes. A later nightly may work too; check the compatibility results if it fails.

The archive already contains the package URLs you need. Keep each application’s whole folder: main.roc imports the neighboring module that does the calculation.

Run the booking example§

From the extracted folder:

roc version
roc examples/booking_exchange/main.roc

The version command lets you compare your compiler with the release notes. The application prints:

Restored available booking windows (UTC)
2026-06-15T09:00:00.000000Z/2026-06-15T10:00:00.000000Z
2026-06-15T12:00:00.000000Z/2026-06-15T15:00:00.000000Z
2026-06-15T16:00:00.000000Z/2026-06-15T17:00:00.000000Z

Each line is a free interval with its start and end separated by /. The shop opens at 09:00 UTC and closes at 17:00. One booking arrives as 12:00–14:00 at UTC+02:00, which is 10:00–12:00 UTC; the other occupies 15:00–16:00 UTC.

Roc downloads the content-addressed package dependencies on first use. You don’t need Python or a separate example runner.

Change an input§

Open examples/booking_exchange/main.roc. Remove the second booking, 2026-06-15T15:00:00Z/2026-06-15T16:00:00Z, from the list and run the application again. The two afternoon windows join into a single 12:00–17:00 UTC window.

You can also move a booking by editing its timestamps. Keep the Z or numeric offset: without one, a local clock time doesn’t tell the application where the booking belongs on the timeline. BookingExchange.roc parses the text and subtracts the occupied time through the public library API.

Use the library in your own app§

Copy the time dependency from an archived example’s header into your application’s header, keeping your own platform declaration. This gives you the exact package URL tested for that release. The library doesn’t pin your compiler.

For named zones, also copy the zones dependency from the archived examples/staffing/main.roc. It supplies timezone data separately, so an application working only with explicit offsets doesn’t need the database.

If you copied an example from the repository instead, its relative dependencies point at the local checkout. Versions explains how to keep source, packages and API documentation together.

Choose your next step§

If an imported API is missing, compare your package URL with the example’s version before changing the compiler or rewriting imports.