menu_bookDocumentation

RealTime vs Time: Wall-Clock vs Scene Time — RealTimeSince, RealTimeUntil, GlobalNow, and SmoothDelta

calendar_today May 4, 2026 schedule ~1 min read person patrickjr verified 50

RealTime vs Time: Wall-Clock vs Scene Time — When to Use Each

s&box has two time systems. Choosing the wrong one is a common source of bugs.

Time (Scene Time)

Time.Now, Time.Delta, Time.NowDouble — scene-relative time. Respects Scene.TimeScale and pausing. This is what TimeSince and TimeUntil use.
CSHARP
// Use for: game logic, physics, animations, anything that should pause/slow with the scene
protected override void OnUpdate()
{
    timer += Time.Delta;  // pauses when game is paused
}

RealTime (Wall-Clock Time)

RealTime.Now, RealTime.Delta, RealTime.NowDouble — actual elapsed time since game startup. Never pauses. This is what RealTimeSince and RealTimeUntil use.
CSHARP
// Use for: UI animations, loading screens, anything that should NOT pause
RealTimeSince lastClick = 0;
if ( lastClick > 0.5f ) { /* debounce */ }

RealTime.GlobalNow

RealTime.GlobalNow is a special value that should match between servers and clients (if their system clocks are correct). It's based on a fixed epoch (Jan 1, 2022) plus elapsed time. RealTimeSince and RealTimeUntil use this, not RealTime.Now.

RealTime.SmoothDelta

RealTime.SmoothDelta is a smoothed version of RealTime.Delta (lerped at 10% per frame). Use this for camera smoothing or other cases where frame time spikes would cause jarring movement.

RealTimeSince and RealTimeUntil

These work identically to TimeSince and TimeUntil but use RealTime.GlobalNow:

CSHARP
RealTimeSince lastFired = 0;
if ( lastFired > 0.5f ) { Fire(); lastFired = 0; }

RealTimeUntil cooldown = 2f;
if ( cooldown ) { /* 2 real seconds have passed */ }

Key Difference

TimeRealTime
Pauses with gameYesNo
Respects TimeScaleYesNo
Struct typesTimeSince, TimeUntilRealTimeSince, RealTimeUntil
Use forGame logicUI, loading, menus
Was this helpful?