Made output better readable

This commit is contained in:
tastytea 2018-03-02 14:08:49 +01:00
parent f7a17dff09
commit 1142f6749a
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
3 changed files with 26 additions and 4 deletions

View File

@ -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)

View File

@ -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

View File

@ -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";
}
}
}