From 436366a69e78b70e4df837d1b076bc7e5c48a4b7 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 16 Feb 2011 12:57:13 +0000 Subject: Align the clock on the dedicated serer console with the console timestamps, improved uptime format. --- src/dedicated/console.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/dedicated') 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() -- cgit v1.2.3