app.clock

Dataset clock: maps wall-clock time onto the dataset’s timeline.

The dataset is one service day, 2026-01-06, with naive Moscow-local timestamps. Live telemetry (the emulator, real terminals) carries today’s wall-clock time. Every component converts through one DatasetClock, so live and historical data share a single timeline:

dataset_time = anchor_dataset + (wall_time - anchor_wall) * speed

Default anchor: at startup, the current Moscow time of day on the dataset day, speed 1 — the demo shows the dataset’s vehicles «as of now». GET /clock publishes the anchor, so external drivers (infra/emulator_replay.py --clock-url) replay tracks on exactly this timeline.

Classes

DatasetClock(anchor_wall, anchor_dataset[, ...])

class app.clock.DatasetClock(anchor_wall: 'float', anchor_dataset: 'datetime', speed: 'float' = 1.0)[исходный код]

Базовые классы: object

__init__(anchor_wall: float, anchor_dataset: datetime, speed: float = 1.0) → None
anchor_dataset: datetime
anchor_wall: float
now() → datetime[исходный код]
speed: float
classmethod starting_at(dataset_time: datetime | None = None, *, day: date = datetime.date(2026, 1, 6), speed: float = 1.0, wall: float | None = None) → DatasetClock[исходный код]

A clock whose dataset time at wall (default: now) is dataset_time (default: the current Moscow time of day on day).

to_dataset(wall: float) → datetime[исходный код]
to_wall(dataset_time: datetime) → float[исходный код]