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.
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.
A client takes the round trip ClockConvergence reports into its allowance
for lateness.
Each ClockConvergence sets a client’s allowance to 0.8 times what it was
plus 0.1 times the round trip it reports.
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 0.8.13.26–0.9.22.13
A client’s match clock starts at 0 as the client finishes loading, and runs on the client’s own timer from then; a
ClockSyncsets it wherever it stands.
In 0.9.25.24–1.0.0.24
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.
In 0.9.25.24–1.0.0.24
GameSpeedsets the pace of the match clock, and a hold sets the pace to 0 until play resumes. A server that runs a match at other than normal speed MUST sendGameSpeedwith that speed, or a client’s match clock runs apart from its own.
In 0.9.25.24–1.0.0.24
A client runs no clock but the match clock, and takes whatever speed
GameSpeedgives.
In 0.9.25.24–0.9.25.35
A
GameSpeedthat arrives during a hold sets the match clock running again at once.
A client shows the match’s time counted from the moment on the match clock at which the match began.
In 0.8.13.26–0.9.25.35
A client takes that moment from its own match clock, once, as its game loop runs.
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.
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).