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.
In 3.01–3.10
Each
ClockConvergencesets a client’s allowance to 0.8 times what it was plus 0.1 times the round trip it reports.
In 3.01–3.10
The allowance starts at 0, and nothing but
ClockConvergencechanges it: a client that has had none takesClockSyncas it stands. A server SHOULD sendClockConvergence, or eachClockSyncsets a client’s clock behind by the time it took to arrive.
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.
A client’s match clock does not run until the first ClockSync arrives, which
sets it. After that it runs on the client’s own timer, and a later
ClockSync only corrects it, however long a server leaves between them.
In 3.01–3.10
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 3.01–3.10
A
GameSpeedthat arrives during a hold takes effect as play resumes.
In 3.10
A client holds the speed
GameSpeedgives to between 0 and 10 times normal.
A client shows the match’s time counted from the moment on the match clock at which the match began.
In 3.01–3.10
MatchStartedgives that moment. Until it arrives, a client takes the match clock’s reading as its game loop runs, and aMatchStartedarriving later replaces it. While the match clock is before that moment, a client shows a negative time.
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).