MCPcopy Create free account
hub / github.com/chen3feng/toft / GetStartTime

Function GetStartTime

system/process/this_process.cpp:32–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32static time_t GetStartTime()
33{
34 int hz = sysconf(_SC_CLK_TCK);
35 double uptime;
36 if (!StringToNumber(ReadField("/proc/uptime", 0), &uptime))
37 return -1;
38 double start_time;
39 if (!StringToNumber(ReadField("/proc/self/stat", 21), &start_time))
40 return -1;
41
42 return static_cast<time_t>(time(NULL) - uptime + start_time / hz);
43}
44
45pid_t ThisProcess::GetId()
46{

Callers

nothing calls this directly

Calls 2

ReadFieldFunction · 0.85
StringToNumberFunction · 0.50

Tested by

no test coverage detected