Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 2: [PATCH 02/68] feat(runtime): preserve Roots operator controls on Core 30.3

src/common/system.cpp

Before: src/common/system.cpp · After: src/common/system.cpp

File metadata
index 35a6f4415bcc2602c379162b3802a740620dfb5f..bab3133a2485bda3b1a1dd2021ed69397781d536 100644

Download original patch · Release notes

Diff rows 1–33 of 33. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/common/system.cpp CHANGED
@@ -36,9 +36,6 @@
36
36
 
37
37
  using util::ReplaceAll;
38
38
 
39
- // Application startup time (used for uptime calculation)
40
- const int64_t nStartupTime = GetTime();
41
-
42
39
  #ifndef WIN32
43
40
  std::string ShellEscape(const std::string& arg)
44
41
  {
@@ -57,8 +54,9 @@ void runCommand(const std::string& strCommand)
57
54
  #else
58
55
  int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().from_bytes(strCommand).c_str());
59
56
  #endif
60
- if (nErr)
61
- LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
57
+ if (nErr) {
58
+ LogWarning("runCommand error: system(%s) returned %d", strCommand, nErr);
59
+ }
62
60
  }
63
61
  #endif
64
62
 
@@ -127,8 +125,8 @@ std::optional<size_t> GetTotalRAM()
127
125
  return std::nullopt;
128
126
  }
129
127
 
130
- // Obtain the application startup time (used for uptime calculation)
131
- int64_t GetStartupTime()
132
- {
133
- return nStartupTime;
134
- }
128
+ namespace {
129
+ const auto g_startup_time{SteadyClock::now()};
130
+ } // namespace
131
+
132
+ SteadyClock::duration GetUptime() { return SteadyClock::now() - g_startup_time; }