Files
Course-Design-C--/tools.cpp
2025-04-15 18:38:03 +08:00

13 lines
323 B
C++

#include "tools.h"
std::string get_utc8_time() {
auto now = std::chrono::system_clock::now();
std::time_t now_time = std::chrono::system_clock::to_time_t(now);
now_time += 8 * 3600;
std::tm *tm = std::gmtime(&now_time);
std::stringstream ss;
ss << std::put_time(tm, "%Y-%m-%d %H:%M:%S");
return ss.str();
}