From 1142f6749a8b3e3fa0bdac78d75232a038289119 Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 2 Mar 2018 14:08:49 +0100 Subject: [PATCH] Made output better readable --- CMakeLists.txt | 5 ++--- README.md | 1 + src/mastobotmon.cpp | 24 +++++++++++++++++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c0f3873..0d2573d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required (VERSION 3.7) project (mastobotmon - VERSION 0.1.2 - LANGUAGES CXX -) + VERSION 0.1.3 + LANGUAGES CXX) include(GNUInstallDirs) diff --git a/README.md b/README.md index 9fd6f85..c2d60d5 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ If you use a debug build, you get more verbose error messages. * [x] Allow to add accounts later * [ ] Write mentions to file * Version 0.3.0 + * [ ] Respect X-RateLimit header * [ ] Write statistics to file * Version 0.4.0 * [ ] Daemon mode diff --git a/src/mastobotmon.cpp b/src/mastobotmon.cpp index 1665c6e..f9a37cf 100644 --- a/src/mastobotmon.cpp +++ b/src/mastobotmon.cpp @@ -98,7 +98,29 @@ int main(int argc, char *argv[]) if (elapsed.count() > acc.get_minutes()) { - cout << "ALERT: " << acct << " is inactive since " << elapsed.count() << " minutes.\n"; + uint16_t minutes = elapsed.count(); + std::uint8_t hours = 0; + std:: uint8_t days = 0; + while (minutes >= 1440) + { + minutes -= 1440; + days += 1; + } + while (minutes >= 60) + { + minutes -= 60; + hours += 1; + } + cout << "ALERT: " << acct << " is inactive since "; + if (days > 0) + { + cout << std::to_string(days) << " days, "; + } + if (hours > 0) + { + cout << std::to_string(hours) << " hours and "; + } + cout << std::to_string(minutes) << " minutes.\n"; } } }