| 77 | } |
| 78 | |
| 79 | uint64_t utc() |
| 80 | { |
| 81 | #if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) |
| 82 | struct timespec timestamp; |
| 83 | if (clock_gettime(CLOCK_REALTIME, ×tamp) != 0) |
| 84 | throw std::runtime_error("Cannot get value of CLOCK_REALTIME timer!"); |
| 85 | return (timestamp.tv_sec * 1000000000) + timestamp.tv_nsec; |
| 86 | #elif defined(_WIN32) || defined(_WIN64) |
| 87 | FILETIME ft; |
| 88 | GetSystemTimePreciseAsFileTime(&ft); |
| 89 | |
| 90 | ULARGE_INTEGER result; |
| 91 | result.LowPart = ft.dwLowDateTime; |
| 92 | result.HighPart = ft.dwHighDateTime; |
| 93 | return (result.QuadPart - 116444736000000000ull) * 100; |
| 94 | #endif |
| 95 | } |
| 96 | |
| 97 | uint8_t unhex(char ch) |
| 98 | { |
no outgoing calls