Skip to content

Commit

Permalink
Use monotonic timings for A2A_PING
Browse files Browse the repository at this point in the history
  • Loading branch information
Holiverh committed Sep 10, 2017
1 parent 8de5e27 commit 7fb8624
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions valve/source/a2s.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import (absolute_import,
unicode_literals, print_function, division)

import time
import monotonic

import valve.source
from . import messages
Expand Down Expand Up @@ -64,10 +64,11 @@ def ping(self):
be negligble.
"""

t_send = time.time()
time_sent = monontic.monotonic()
self.request(messages.InfoRequest())
messages.InfoResponse.decode(self.get_response())
return (time.time() - t_send) * 1000.0
time_received = monotonic.monotonic()
return (time_received - t_sent) * 1000.0

def info(self):
"""Retreive information about the server state
Expand Down

0 comments on commit 7fb8624

Please sign in to comment.