deleted more stringstrem
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled

This commit is contained in:
wt committed 2025-04-17 17:01:16 +07:00
1 parent e0f5ca7266
commit e194a44bf9
3 files changed
+20 -24

No files matched your search

+8 -10
View File
@@ -2,7 +2,6 @@
#ifdef __linux__
#include <sys/sysinfo.h>
#endif // __linux__
#include <sstream>
#include <types.hpp>
namespace api
@@ -15,15 +14,14 @@ namespace api
struct sysinfo x;
if (sysinfo(&x) == 0)
{
std::stringstream responsedata;
responsedata << R"({"uptime":{"hour":")"
<< static_cast<unsigned long long>(x.uptime) / 3600ULL
<< R"(","minute":")"
<< static_cast<unsigned long long>(x.uptime) / 60ULL % 60ULL
<< R"(","second":")"
<< static_cast<unsigned long long>(x.uptime) % 60ULL
<< R"("}})";
response.set_content(responsedata.str(), JSON_TYPE);
std::string responsedata(R"({"uptime":{"hour":")"
+ std::to_string(static_cast<unsigned long long>(x.uptime) / 3600ULL)
+ R"(","minute":")"
+ std::to_string(static_cast<unsigned long long>(x.uptime) / 60ULL % 60ULL)
+ R"(","second":")"
+ std::to_string(static_cast<unsigned long long>(x.uptime) % 60ULL)
+ R"("}})");
response.set_content(responsedata, JSON_TYPE);
return;
}
response.set_content(R"({"error":"unknown"})", JSON_TYPE);