| 40 | #endif // _darwin_ |
| 41 | |
| 42 | TDuration Uptime() { |
| 43 | #if defined(_win_) |
| 44 | return TDuration::MilliSeconds(GetTickCount64()); |
| 45 | #elif defined(_linux_) |
| 46 | struct timespec ts; |
| 47 | int ret = clock_gettime(CLOCK_BOOTTIME, &ts); |
| 48 | Y_ENSURE_EX(ret != -1, TSystemError() << "Failed to read the CLOCK_BOOTTIME timer"); |
| 49 | return TDuration::Seconds(ts.tv_sec) + TDuration::MicroSeconds(ts.tv_nsec / 1000); |
| 50 | #elif defined(_darwin_) || defined(_freebsd_) |
| 51 | return GetBSDUptime(); |
| 52 | #elif defined(_emscripten_) |
| 53 | ythrow yexception() << "unimplemented"; |
| 54 | #else |
| 55 | #error "Implement this method" |
| 56 | #endif |
| 57 | } |
no test coverage detected