From 677222fa12630a2c5db660cfb7d66e22a2e8353b Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 15 Aug 2021 15:40:38 +0200 Subject: [PATCH] statustime: No empty lines, flush before exit. --- statustime.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/statustime.cpp b/statustime.cpp index 0153273..a4f8bfd 100755 --- a/statustime.cpp +++ b/statustime.cpp @@ -17,7 +17,8 @@ void signal_handler(int signum) case SIGTERM: case SIGINT: { - std::cout << "\nTime script terminated.\n"; + std::cout << R"(Time script terminated.)" + << std::endl; std::exit(signum); // NOLINT(concurrency-mt-unsafe) break; } @@ -32,6 +33,7 @@ int main() { using fmt::format; using std::cout; + using std::endl; using clock = std::chrono::system_clock; using std::chrono::minutes; using namespace std::chrono_literals; @@ -51,7 +53,7 @@ int main() R"({0:%Y-%m-%d} )" R"({0:%H:%M})", now) - << std::endl; // NOTE: Don't forget that we need to flush! 😊 + << endl; // NOTE: Don't forget that we need to flush! 😊 const auto next_minute{std::chrono::floor(now + 1min)}; std::this_thread::sleep_until(next_minute); @@ -59,7 +61,7 @@ int main() } catch (const std::exception &e) { - cout << "\nError: Time script crashed.\n"; + cout << R"(Time script crashed.)" << endl; std::cerr << e.what() << '\n'; return 33; }