| 28 | } |
| 29 | |
| 30 | int 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 | |
| 49 | void CPingThread::OnExecute(uint32_t nowTime) |
| 50 | { |
nothing calls this directly
no test coverage detected