CLOCK_MONOTONIC and CLOCK_BOOTTIME while suspended so timers and watchdogs keep their remaining budgets across pause and resume. By default, VM sandboxes resynchronize CLOCK_REALTIME (wall time) to host Coordinated Universal Time (UTC) on boot, every 10s, and after resume. You can disable host wall-clock sync at runtime from inside your sandbox or through the sandbox HTTP API when your workload needs wall time frozen across suspension or wants a guest time daemon to own the clock.
How clocks behave across suspend and resume
Suspend, resume, and memory snapshots share one clock contract on VM sandboxes. When a sandbox suspends, the hypervisor captures guest timer state and excludes time spent draining devices, exporting checkpoints, or waiting paused from monotonic clocks.
Unlike native Linux sleep, where
CLOCK_BOOTTIME advances during sleep, external sandbox suspension excludes paused time from both CLOCK_MONOTONIC and CLOCK_BOOTTIME. Ordinary CPU idle time and host scheduling delays still count as awake time.
Each restore from a memory snapshot continues its own independent captured timeline. Restoring from a filesystem-only snapshot starts a fresh kernel with reset boot clocks and wall-clock sync enabled.
Default wall-clock sync
On VM sandboxes, the in-guest daemon reads host UTC from the Kernel-based Virtual Machine (KVM) virtual Precision Time Protocol (PTP) device (/dev/ptp0, verified against /sys/class/ptp/ptp0/clock_name). An initial boot sync finishes before your sandbox entrypoint runs, so boot-time TLS validation and timestamps start on current UTC even if your entrypoint turns sync off right away.
While wall-clock sync stays enabled, the daemon steps CLOCK_REALTIME whenever the absolute offset from host UTC reaches at least 100 ms:
- On boot: runs one initial check before the daemon releases your entrypoint
- Every 10s: corrects steady-state clock drift or host Network Time Protocol (NTP) adjustments
- On resume: wakes immediately from
/dev/vmclock0after pause and resume or memory-snapshot restore, without blocking sandbox readiness
/proc for guest time services such as chronyd or systemd-timesyncd. If your image runs its own NTP daemon or relies on a custom wall-clock timeline, disable the built-in syncer explicitly so the two don’t compete.
Control wall-clock sync at runtime
You can read or toggle wall-clock sync from inside the sandbox over a root-only Unix domain socket, or from outside the sandbox through the authenticated sandbox HTTP API. Both endpoints drive the same in-memory controller inside the guest daemon.Disable requests wait for any in-flight
clock_settime call to finish before returning 200 OK, so no correction races with your workload after the call succeeds. Re-enabling wakes the syncer immediately to re-anchor CLOCK_REALTIME to host UTC.- Inside the sandbox (Unix socket)
- Outside the sandbox (HTTP API)
The guest daemon binds This sends a Re-enable host UTC syncing later by sending If your base image includes Python instead of This opens
/run/tensorlake/guest.sock before releasing your entrypoint. Only root (mode 0600 plus kernel SO_PEERCRED verification for UID 0) can connect, and the socket exposes only /v1/clock-sync. Host-only daemon ports (9500, 9501, and 9502) stay unreachable from inside the sandbox.Disable wall-clock sync in your entrypoint with curl before starting a rollout or custom timeline:PUT request over /run/tensorlake/guest.sock and returns the updated JSON status once any in-flight clock step has finished.Check the current state at any time with GET:{"enabled": true}:curl, send the same HTTP request over socket.AF_UNIX:/run/tensorlake/guest.sock, sends a single PUT /v1/clock-sync request with Connection: close, and prints the parsed JSON status.Persistence across lifecycle events
The toggle lives in the guest daemon’s memory rather than on disk, so its behavior matches whether the guest process stays alive across a sandbox lifecycle transition.
If your workload restores from a filesystem-only snapshot or cold boots a new sandbox, disable clock sync again in your entrypoint or driver before starting time-sensitive work.
Runtime support and responses
Both/v1/clock-sync and /api/v1/clock-sync return Cache-Control: no-store and a JSON status object. Check configurable before assuming you can turn sync off on a given runtime.
Under the gVisor runtime used by GPU sandboxes, the Sentry serves host wall time directly and can’t stop tracking the host clock, so
PUT fails closed with 501 Not Implemented.
Requests to /v1/clock-sync and /api/v1/clock-sync also enforce strict input bounds:
- Unknown JSON fields: rejected with
422 Unprocessable Entity - Malformed JSON: rejected with
400 Bad Request - Request bodies over 4 KB: rejected with
413 Payload Too Large - Stalled Unix socket connections: closed after 15s (or immediately on daemon shutdown)
See also
Lifecycle
Understand sandbox states, idle timeouts, and suspend and resume.
Snapshot and Clone
Compare memory snapshots and filesystem-only snapshots.
Get Clock Sync Status
HTTP reference for
GET /api/v1/clock-sync.Set Clock Sync
HTTP reference for
PUT /api/v1/clock-sync.