MCPcopy Create free account
hub / github.com/catboost/catboost / Uptime

Function Uptime

util/datetime/uptime.cpp:42–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40#endif // _darwin_
41
42TDuration 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}

Callers 3

Y_UNIT_TESTFunction · 0.85
ProcessUptimeFunction · 0.85
Y_UNIT_TESTFunction · 0.85

Calls 5

MilliSecondsFunction · 0.85
TSystemErrorClass · 0.85
MicroSecondsFunction · 0.85
GetBSDUptimeFunction · 0.85
SecondsFunction · 0.50

Tested by

no test coverage detected