# World clock — appearance as a pure function of the hour

**Lesson embodied.** A world's time-of-day look should be *computed*,
never *counted*. `worldClock(hour)` returns everything a scene needs
to look like that hour — sun position, the renderer's three lights,
ambient, the night-window signal, the water phase — from the hour
alone. No accumulated state, no frame counters: any hour renders
standalone, re-rendering an hour is identical, and a world opened
after a week away is simply at the correct hour because the hour was
always a function input. The companion doctrine (source spec §3): the
breathing layer may only modulate quantities that are already
presentation — light level/colour, water phase — and may never
introduce new facts about the world.

## Provenance

Carried in **verbatim** from
`~/workspace/dimentra-review/renderer-gallery/world-clock/world-clock.cjs`
(2026-11-06 proof module; logic intact — verified during distillation
by deep-equality against the source module at 10 sampled hours). The
only changes are the provenance header and the added `meta` export.
Spec and record: `world-clock/WORLD-CLOCK.md`, `world-clock/RECEIPT.md`,
`world-clock/measurements.json`. Solar model as filed: sunrise 06:00,
sunset 18:45, peak elevation 64° at ~12:22; twilight
`exp(−(el/22°)²)` (declared stylization — a generous tail so dawn and
dusk linger); key = sun by day / moon by night blended across
elevation ∈ [−4°, +2°]; windows glow `smoothstep((4°−el)/16°)`, warm
[255, 186, 105] × 1.35·W, no sparkle; exposure constant 1.15 so hours
stay comparable.

## How to run

```text
node example.cjs   # the six pinned hours, key quantities
node check.cjs     # PASS <n> FAIL <m>; also exports runCheck()
```

`program.cjs` exports `worldClock` and `meta`. Node builtins only
(the source module has no imports at all).

## Worked example

`example.cjs` evaluates the six pinned hours from
`example/panels.json` and prints phase, sun elevation, twilight,
ambient, key intensity and window glow beside the filed board mean
RGB for each hour — dawn [40, 50, 27] through day [95, 118, 77] to
night [27, 39, 24] — plus the JSON summary line.

## Fixture

`example/panels.json` — minimized extraction (2026-11-07) from
`world-clock/measurements.json`: the six panels' scalar clock outputs
(phase, sun elevation/azimuth/above-horizon, twilight, ambient,
key-light intensity, window glow, board mean RGB) and the filed
determinism record. Frame hashes/render costs stay in the source.

## Filed numbers the check reproduces

- **Determinism (function level):** `worldClock(h)` deep-equals
  `worldClock(h)` on a second call at 5.5, 13, and 23.5; hour wrap
  37 ≡ 13; exposure 1.15; window emissive colour [255, 186, 105].
- **All six filed panels, through the module, exactly:** for each of
  5.5 / 8 / 13 / 17.75 / 20.25 / 23.5 — phase, sun elevation
  (−7.9 / 30.3 / 63.2 / 15.6 / −23.1 / −58.9), azimuth, twilight
  (0.88 / 0.15 / 0 / 0.604 / 0.331 / 0.001), ambient
  (0.081 / 0.117 / 0.15 / 0.077 / 0.052 / 0.035), key intensity
  (0.308 / 1.529 / 2.984 / 0.728 / 0.5 / 0.5), and window glow
  (0.8341414897474386 at dawn; exactly 0 at 8/13/17.75; exactly 1 at
  dusk/night) all equal `measurements.json`.

## Consumers

Board lighting at pinned hours, emblem renders, GameM8c scenes, N64
rendition — any scene that takes its light from the hour; LIVE mode
reads the device RTC, LAB mode pins hours for receipts (source spec §2).

## Honest limits

- The render-level determinism claim (13:00 rendered twice →
  byte-identical PNG, sha256 `aa8360867e728614…`) belongs to the
  renderer + board, not to this function; it is **cited**, not
  reproduced — this check proves the function's own purity, which is
  the part the library carries.
- The solar model is stylized, shaped honestly (source spec §1): a
  fixed date-free curve, northern-hemisphere path, no seasons, no
  latitude input. It is a house clock, not an ephemeris.
- Window *luma ratios* in the filed panels (panes 5.2× frame mean at
  23:30) are render measurements of the board scene; the function
  output they derive from (glow/emission) is what is reproduced here.
