Deterministic clock

결정적 시간 제어

Move a test’s virtual clock to reproduce time boundaries and timer behavior.

···
html
<div class="stage"><div class="title">VIRTUAL CLOCK</div><div class="canvas"><div class="clockTrack"><span>09:00</span><i id="clockHand"></i><span>12:00</span></div><div class="clockNow" id="clockNow">09:00</div><div class="clockState" id="clockState">booking OPEN</div></div></div>
css
.stage{width:min(94vw,820px);height:min(88vh,330px);box-sizing:border-box;padding:clamp(9px,2.4vmin,18px);border:1px solid var(--line);border-radius:13px;background:var(--surface);display:flex;flex-direction:column;gap:clamp(7px,2vmin,14px);font:600 clamp(12px,2.5vmin,16px)/1.28 "Pretendard Variable",Pretendard,-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo",sans-serif;color:var(--fg);overflow:hidden}.title{color:var(--accent);letter-spacing:.035em;flex:none}.canvas{position:relative;flex:1;min-height:0;display:flex;align-items:center;justify-content:center}.muted{color:var(--muted)}.mono{font-family:ui-monospace,SFMono-Regular,monospace}.box{border:1px solid var(--line);border-radius:8px;background:var(--bg);padding:clamp(5px,1.4vmin,12px);text-align:center}.active{border-color:var(--accent)!important;color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 12%,var(--surface))!important}.canvas{flex-direction:column;gap:clamp(7px,3vmin,17px)}.clockTrack{position:relative;width:min(88%,530px);border-top:3px solid var(--line);display:flex;justify-content:space-between;padding-top:7px}.clockTrack i{position:absolute;top:-9px;left:0;width:15px;height:15px;background:var(--accent);border-radius:50%;transition:left .4s}.clockNow{font-size:clamp(20px,5vmin,32px);font-family:ui-monospace,monospace;color:var(--accent)}.clockState{border:1px solid var(--accent);border-radius:5px;padding:clamp(5px,1.5vmin,10px)}.clockState.closed{border-color:var(--accent-3);color:var(--accent-3)}
js
let n=0;function jump(){const step=n++%3;document.getElementById('clockHand').style.left=['0%','51%','97%'][step];document.getElementById('clockNow').textContent=['09:00','10:30','12:00'][step];document.getElementById('clockState').textContent=step===2?'booking CLOSED':'booking OPEN';document.getElementById('clockState').classList.toggle('closed',step===2)}jump();setInterval(jump,700)

Deterministic clock control fixes or advances the date and timers seen by the browser without real waiting. It makes deadline and midnight boundaries repeatable.

The demo jumps a virtual clock to a deadline and changes the state from open to closed. Server and external-service clocks are separate, so account for them in the test boundary.

When to use

Use it to reproduce scheduling, expiry, and countdown behavior.

Open as page ↗