Time
Which clocks a match runs on, and which of them each time on the wire is measured against.
How a time is carried
A time is in seconds, as a 32-bit float, unless its definition says otherwise. A field is either a moment, read against a clock, or a duration, which starts when the message arrives. Every definition says which.
Exceptions:
Pausedcarries the time left in a hold as a whole number of seconds.- A stream’s chunk and key frame intervals (
StreamMetadata) are in milliseconds.
In 4.17
The time between two of a stream’s records (
StreamRecord) is in milliseconds.
In 4.18–4.20
MapPropChangedgives when its change begins in milliseconds of match time.
The match clock
The match runs on a server’s clock, which counts seconds from 0 as play begins.
ClockSync states where it stands, and a client sets its own clock to that,
plus its allowance for how late the statement arrived. A client answers with
ClockReply, from which a server measures the round trip. A server can report
the round trip it measured with ClockConvergence.
In 4.1–4.19
A client takes the round trip
ClockConvergencereports into its allowance for lateness.
A server sends ClockSync with 0 as play begins (see
Joining a match), and again whenever it means a client’s clock to
catch up with its own.
In 4.1–4.19
A client’s match clock does not run until the first
ClockSyncarrives, which sets it. After that it runs on the client’s own timer, and a laterClockSynconly corrects it, however long a server leaves between them.
A client shows the match’s time counted from the moment on the match clock at which the match began.
MatchStarted gives that moment, and a client shows zero while the match
clock is before it.
Moments on the match clock include:
- when a monster arrives (
CreateNeutral’sspawnAt, where it carries one); - when a prop’s animation starts (
MapPropChanged, where it carries one); - when an assisting unit last dealt damage (
ClientEvent); - when a champion’s passive comes off cooldown, where a client is told it (see Replication).
A server MUST state each of these on the clock it sends in ClockSync.
In 4.1–4.19
The game clock
A client also runs a game clock of its own, whose pace
GameSpeedsets, from 0 to 10 times normal, and whichClockSyncdoes not set. How long a unit stays dead, how long an object lives, and how long a client waits before removing a dead unit (see Objects and identifiers) run on it. A server that runs a match at other than normal speed MUST sendGameSpeedwith that speed, or those durations run apart from its own.
A stream’s clock
A watching client plays a stream against a clock of the stream’s own, which the stream’s records set (see Watching a match).