MCPcopy Create free account
hub / github.com/crossuo/crossuo / CalculatePing

Method CalculatePing

src/Utility/PingThread.cpp:30–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30int CPingThread::CalculatePing()
31{
32 auto handle = icmp_open();
33 if (handle == nullptr)
34 {
35 return -4;
36 }
37
38 uint32_t start = SDL_GetTicks();
39 int result = icmp_query(handle, ServerIP.c_str(), &start);
40 if (result == 0)
41 {
42 result = (SDL_GetTicks() - start);
43 }
44
45 icmp_close(handle);
46 return result;
47}
48
49void CPingThread::OnExecute(uint32_t nowTime)
50{

Callers

nothing calls this directly

Calls 5

icmp_openFunction · 0.85
icmp_queryFunction · 0.85
icmp_closeFunction · 0.85
c_strMethod · 0.80
SDL_GetTicksFunction · 0.50

Tested by

no test coverage detected