Ping
Internal ping calculation
Pseudocode
void SendPingRequest() {
int64_t t;
PingRequest req;
QueryPerformanceCounter(&t);
req.timestamp = (int32_t)(t / 10000);
SendMessage(req);
}
int32_t HandlePingResponse(PingResponse resp) {
int64_t currT;
int32_t prevMs = resp.timestamp;
QueryPerformanceCounter(&currT);
int32_t currMs = (int32_t)(currT / 10000);
return currMs - prevMs;
}Remarks
Last updated
Was this helpful?