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

Function GetBootTime

util/datetime/uptime.cpp:14–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12#if defined(_darwin_) || defined(_freebsd_)
13namespace {
14 TInstant GetBootTime() {
15 struct timeval timeSinceBoot;
16 size_t len = sizeof(timeSinceBoot);
17 int request[2] = {CTL_KERN, KERN_BOOTTIME};
18 if (sysctl(request, 2, &timeSinceBoot, &len, nullptr, 0) < 0) {
19 ythrow yexception() << "cannot get kern.boottime from sysctl";
20 }
21 return TInstant::MicroSeconds(timeSinceBoot.tv_sec * 1'000'000 + timeSinceBoot.tv_usec);
22 }
23
24 TDuration GetBSDUptime() {
25 TInstant beforeNow;

Callers 1

GetBSDUptimeFunction · 0.85

Calls 1

MicroSecondsFunction · 0.85

Tested by

no test coverage detected