diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-02 11:20:54 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-09-02 11:20:54 +0200 |
commit | a4e9116570c5bc6fee8368d9ce16a24547026cba (patch) | |
tree | b70f6965a0186986fd40f9c802ef1eb72465a555 /accounts/gkleen@sif/shell/quickshell-plugins/Chrono.cpp | |
parent | 7b6f07aff506155ad0dbd574ed5aafa3e2870613 (diff) | |
download | nixos-a4e9116570c5bc6fee8368d9ce16a24547026cba.tar nixos-a4e9116570c5bc6fee8368d9ce16a24547026cba.tar.gz nixos-a4e9116570c5bc6fee8368d9ce16a24547026cba.tar.bz2 nixos-a4e9116570c5bc6fee8368d9ce16a24547026cba.tar.xz nixos-a4e9116570c5bc6fee8368d9ce16a24547026cba.zip |
...
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell-plugins/Chrono.cpp')
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell-plugins/Chrono.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell-plugins/Chrono.cpp b/accounts/gkleen@sif/shell/quickshell-plugins/Chrono.cpp index 929b7be6..df0c5781 100644 --- a/accounts/gkleen@sif/shell/quickshell-plugins/Chrono.cpp +++ b/accounts/gkleen@sif/shell/quickshell-plugins/Chrono.cpp | |||
@@ -75,14 +75,10 @@ void Chrono::schedule(const std::chrono::time_point<std::chrono::system_clock>& | |||
75 | this->timer.start(delay); | 75 | this->timer.start(delay); |
76 | } | 76 | } |
77 | 77 | ||
78 | QString Chrono::format() const { return this->mFormat; } | 78 | QString Chrono::format(const QString& fmt) const { |
79 | void Chrono::setFormat(QString format) { | 79 | return QString::fromStdString(std::format(std::runtime_format(fmt.toStdString()), std::chrono::zoned_time(std::chrono::current_zone(), std::chrono::time_point_cast<std::chrono::seconds>(this->currentTime)))); |
80 | if (format == this->mFormat) return; | ||
81 | this->mFormat = format; | ||
82 | emit this->formatChanged(); | ||
83 | this->update(); | ||
84 | } | 80 | } |
85 | 81 | ||
86 | QString Chrono::date() const { | 82 | QDateTime Chrono::date() const { |
87 | return QString::fromStdString(std::format(std::runtime_format(this->mFormat.toStdString()), std::chrono::zoned_time(std::chrono::current_zone(), std::chrono::time_point_cast<std::chrono::seconds>(this->currentTime)))); | 83 | return QDateTime::fromStdTimePoint(std::chrono::time_point_cast<std::chrono::milliseconds>(this->currentTime)); |
88 | } | 84 | } |