diff options
author | Stijn Buys <ingar@osirion.org> | 2011-05-09 20:22:34 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-05-09 20:22:34 +0000 |
commit | bb0f860989f84b901f80017ae0139a3fc0446dc1 (patch) | |
tree | 3b9ef3a5164326d2ad4b531904603ea2afdb40e3 /src/core | |
parent | 3de78ec1bef2a0274a719ea229709523650ade40 (diff) |
Refactored the sys::localtime routines.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/gameserver.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc index 6a20317..85a956d 100644 --- a/src/core/gameserver.cc +++ b/src/core/gameserver.cc @@ -41,16 +41,15 @@ void func_time(std::string const &args) { using namespace std; + // FIXME unify with dedicated server clock int minutes = (int) floorf(server()->time() / 60.0f); int seconds = (int) floorf(server()->time() - (float) minutes * 60.0f); - int syshours = sys::time() / 3600; - int sysminutes = (sys::time() - syshours * 3600) / 60; - int sysseconds = sys::time() % 60; - - con_print << - "Uptime " << minutes << ":" << setfill('0') << setw(2) << seconds << - " Local time " << setfill(' ') << setw(2) << syshours << ":" << setfill('0') << setw(2) << sysminutes << ":" << setw(2) << sysseconds << setfill(' ') << std::endl; + int syshours, sysminutes, sysseconds; + sys::get_localtime(syshours, sysminutes, sysseconds); + + con_print << "Uptime " << minutes << ":" << setfill('0') << setw(2) << seconds << + " Local time " << setfill(' ') << setw(2) << syshours << ":" << setfill('0') << setw(2) << sysminutes << ":" << setw(2) << sysseconds << setfill(' ') << std::endl; } void func_mute(std::string const &args) @@ -525,8 +524,8 @@ void GameServer::frame(unsigned long timestamp) if ((Cvar::sv_dedicated->value() || Cvar::sv_private->value())) { if (core::Cvar::sv_framerate->value()) { - float f = 1000.0f / core::Cvar::sv_framerate->value(); - if (server_startup + this->timestamp() + f > timestamp) { + float fps = ::floorf(1000.0f / core::Cvar::sv_framerate->value()); + if (server_startup + this->timestamp() + (unsigned long) fps > timestamp) { return; } } |