Browse Source

ypdate

master
zhaohe 2 years ago
parent
commit
41aa5df041
  1. 4
      src/main_control_service.cpp

4
src/main_control_service.cpp

@ -270,7 +270,7 @@ void MainControlService::processFrontEndMessage(weak_ptr<WebSocket> webSocket, j
int32_t day = jsonGet<int>(cmd["day"]);
logger->info("updateDate {} {} {}", year, month, day);
// date -s "2023-01-02 02:32:32"
dosystem(fmt::format("date -s \"{}{}{} `date +%T`\"", year, month, day).c_str());
dosystem(fmt::format("date -s \"{}{:02}{:02} `date +%T`\"", year, month, day).c_str());
dosystem(fmt::format("hwclock -w").c_str());
return;
@ -291,7 +291,7 @@ void MainControlService::processFrontEndMessage(weak_ptr<WebSocket> webSocket, j
int32_t second = jsonGet<int>(cmd["second"]);
logger->info("updateDate {}:{}:{}", hour, min, second);
// date -s "2023-01-02 02:32:32"
dosystem(fmt::format("date -s \"`date +%Y-%m-%d` {}:{}:{}\"", hour, min, second).c_str());
dosystem(fmt::format("date -s \"`date +%Y-%m-%d` {:02}:{:02}:{:02}\"", hour, min, second).c_str());
dosystem(fmt::format("hwclock -w").c_str());
return;

Loading…
Cancel
Save