// Print date and time for i3 status bar. #include #include #include #include #include #include #include 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"({0:%A}, )" R"({0:%Y-%m-%d} )" R"({0:%H:%M})", 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 &) { cout << "\nError: Time script crashed.\n"; return 33; } }