Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-02-16 12:57:13 +0000
committerStijn Buys <ingar@osirion.org>2011-02-16 12:57:13 +0000
commit436366a69e78b70e4df837d1b076bc7e5c48a4b7 (patch)
treea4db45ca6e83cdaa34c94567060ec4811bb32943 /src/dedicated
parent3ef5bfcb1bf4c88894a0474b043d87f59744bccd (diff)
Align the clock on the dedicated serer console with the console timestamps,
improved uptime format.
Diffstat (limited to 'src/dedicated')
-rw-r--r--src/dedicated/console.cc15
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()