The program prints the time every second. After a while (usually between 1 and 3 days), the block is not updated anymore. This always seems to happen right after a resume from suspend, but not after every resume. The program does not crash and if I run it in a terminal it works fine. I never see the error message (see below) in the block.
I use this configuration:
[time]
command=statustime
interval=persist
markup=pango
First with this shell-script:
#!/bin/sh
while sleep 1; do
LC_TIME="de_DE.UTF-8"
datetime="$(date +'<b><span color="orange">%A</span></b>, %Y-%m-%d <span color="lightcyan">%H:%M</span>')"
echo "${datetime}"
done
echo -e "\n<span color='red'>Error: Time script crashed.</span>"
exit 33
and now with this C++-program:
Details
#include <fmt/chrono.h>
#include <fmt/core.h>
#include <chrono>
#include <exception>
#include <iostream>
#include <locale>
#include <thread>
int main()
{
using fmt::format;
using std::cout;
using namespace std::chrono_literals;
// Set explicitly, because LC_TIME is en_DK.UTF-8.
std::locale::global(std::locale("de_DE.UTF-8"));
try
{
while (true)
{
cout << format(R"(<b><span color="orange">{0:%A}</span></b>, )"
R"({0:%Y-%m-%d} )"
R"(<span color="lightcyan">{0:%H:%M}</span>)",
std::chrono::system_clock::now())
<< std::endl; // NOTE: Don't forget that we need to flush! 😊
std::this_thread::sleep_for(1s);
}
}
catch (const std::exception &e)
{
cout << "\n<span color='red'>Error: Time script crashed.</span>\n";
std::cerr << e.what() << '\n';
return 33;
}
}
Might be related to #450.
The program prints the time every second. After a while (usually between 1 and 3 days), the block is not updated anymore. This always seems to happen right after a resume from suspend, but not after every resume. The program does not crash and if I run it in a terminal it works fine. I never see the error message (see below) in the block.
I use this configuration:
First with this shell-script:
and now with this C++-program:
Details
Might be related to #450.