ludic/ns-clock.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
2.3 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Clock — Ludic</title>
<meta name="description" content="A game-controlled simulated clock: a single seconds counter the game owns.">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">Clock</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Clock</h1></div>
<p class="ns-blurb">A game-controlled simulated clock: a single seconds counter the game owns. Unlike <code>Time.now</code> / <code>Time.since</code>, it never reads the wall clock, so any gameplay that reads <code>Clock.now()</code> is deterministic and replay-safe. Set it outright, or advance it by a <code>Duration</code> each tick to run time at whatever rate the simulation wants. The clock is a plain instant (seconds since 1970), so all the <code>DateTime.*</code> readers work on it directly.</p>
<div class="ns-methods"><a class="ns-method" href="clock-now.html"><code class="nm-sig">Clock.now() -&gt; int</code><span class="nm-tip">The current simulated instant.</span></a><a class="ns-method" href="clock-set.html"><code class="nm-sig">Clock.set(t)</code><span class="nm-tip">Set the clock to an instant.</span></a><a class="ns-method" href="clock-advance.html"><code class="nm-sig">Clock.advance(span)</code><span class="nm-tip">Move the clock forward by a Duration.</span></a><a class="ns-method" href="clock-reset.html"><code class="nm-sig">Clock.reset()</code><span class="nm-tip">Reset the clock to the epoch (0).</span></a></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>