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