diff options
-rw-r--r-- | src/dedicated/console.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/dedicated/console.cc b/src/dedicated/console.cc index b1629fd..d33fb0b 100644 --- a/src/dedicated/console.cc +++ b/src/dedicated/console.cc @@ -222,11 +222,20 @@ void Console::draw_status() << std::setw(2) << " "; // uptime + int uptime_days = (int) floorf(core::game()->time() / (24.0f * 3600.0f)); + int uptime_hours = (int) floorf(core::game()->time() / 3600.0f); int uptime_minutes = (int) floorf(core::game()->time() / 60.0f); - int uptime_seconds = (int) floorf(core::game()->time() - (float) uptime_minutes * 60.0f); - status << "uptime " << std::setfill(' ') << std::setw(3) << uptime_minutes << ":" << std::setfill('0') << std::setw(2) << uptime_seconds; + int uptime_seconds = (int) floorf(core::game()->time() - (float) uptime_minutes * 60.0f); + + status << "uptime "; + if (uptime_days > 0) { + status << uptime_days << aux::plural("day", uptime_days); + } + status << std::setfill('0') << std::setw(2) << uptime_hours << ":" + << std::setfill('0') << std::setw(2) << uptime_minutes << ":" + << std::setfill('0') << std::setw(2) << uptime_seconds; - mvaddnstr(0, 1, status.str().c_str(), status.str().size()); + mvaddnstr(0, 0, status.str().c_str(), status.str().size()); } } void Console::draw_text() |