15 lines
314 B
C++
15 lines
314 B
C++
#include "widgets/clock.hpp"
|
|
|
|
#include <chrono>
|
|
#include <iomanip>
|
|
|
|
bool Clock::onUpdate() {
|
|
auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
|
|
|
|
std::stringstream ss;
|
|
ss << std::put_time(std::localtime(&now), "%H:%M:%S");
|
|
|
|
set_text(ss.str());
|
|
|
|
return true;
|
|
} |