From efe3b59bc5c7b4c570b5c89154ff20f9ee27c7e0 Mon Sep 17 00:00:00 2001 From: curaga Date: Fri, 30 Aug 2013 12:24:12 +0000 Subject: [PATCH] Rename Time to StkTime, X11 has a type called Time git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13604 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/addons/addon.cpp | 2 +- src/addons/addon.hpp | 4 ++-- src/addons/network_http.cpp | 10 +++++----- src/addons/news_manager.cpp | 2 +- src/config/player.cpp | 2 +- src/config/user_config.cpp | 4 ++-- src/config/user_config.hpp | 14 +++++++------- src/guiengine/widgets/CGUIEditBox.cpp | 4 ++-- src/guiengine/widgets/CGUIEditBox.h | 2 +- src/io/file_manager.cpp | 2 +- src/modes/cutscene_world.cpp | 6 +++--- src/states_screens/addons_screen.cpp | 6 +++--- src/utils/time.cpp | 2 +- src/utils/time.hpp | 2 +- 14 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/addons/addon.cpp b/src/addons/addon.cpp index 864261a7e..515b9e03d 100644 --- a/src/addons/addon.cpp +++ b/src/addons/addon.cpp @@ -162,7 +162,7 @@ void Addon::writeXML(std::ofstream *out_stream) // ---------------------------------------------------------------------------- std::string Addon::getDateAsString() const { - return Time::toString(m_date); + return StkTime::toString(m_date); } // getDateAsString // ---------------------------------------------------------------------------- diff --git a/src/addons/addon.hpp b/src/addons/addon.hpp index 600ee0dbc..9eaca0639 100644 --- a/src/addons/addon.hpp +++ b/src/addons/addon.hpp @@ -99,7 +99,7 @@ private: * in the addons.xml file. */ bool m_still_exists; /** Date when the addon was added. */ - Time::TimeType m_date; + StkTime::TimeType m_date; /** A description of this addon. */ core::stringw m_description; /** The URL of the icon (relative to the server) */ @@ -168,7 +168,7 @@ public: // ------------------------------------------------------------------------ /** Returns the date (in seconds since epoch) when the addon was * uploaded. */ - Time::TimeType getDate() const { return m_date; } + StkTime::TimeType getDate() const { return m_date; } // ------------------------------------------------------------------------ /** Returns a user readable date as a string. */ std::string getDateAsString() const; diff --git a/src/addons/network_http.cpp b/src/addons/network_http.cpp index 2646e19f8..da8587a4b 100644 --- a/src/addons/network_http.cpp +++ b/src/addons/network_http.cpp @@ -270,7 +270,7 @@ CURLcode NetworkHttp::init(bool forceRefresh) bool download = UserConfigParams::m_news_last_updated==0 || UserConfigParams::m_news_last_updated +UserConfigParams::m_news_frequency - < Time::getTimeSinceEpoch() || forceRefresh; + < StkTime::getTimeSinceEpoch() || forceRefresh; if(!download) { @@ -303,7 +303,7 @@ CURLcode NetworkHttp::init(bool forceRefresh) { std::string xml_file = file_manager->getAddonsFile("news.xml"); if(download) - UserConfigParams::m_news_last_updated = Time::getTimeSinceEpoch(); + UserConfigParams::m_news_last_updated = StkTime::getTimeSinceEpoch(); const XMLNode *xml = new XMLNode(xml_file); // A proper news file has at least a version number, mtime, and @@ -319,7 +319,7 @@ CURLcode NetworkHttp::init(bool forceRefresh) status = downloadFileInternal(&r); if(status==CURLE_OK) UserConfigParams::m_news_last_updated = - Time::getTimeSinceEpoch(); + StkTime::getTimeSinceEpoch(); delete xml; xml = new XMLNode(xml_file); } @@ -416,7 +416,7 @@ CURLcode NetworkHttp::loadAddonsList(const XMLNode *xml, bool forceRefresh) { std::string addon_list_url(""); - Time::TimeType mtime(0); + StkTime::TimeType mtime(0); const XMLNode *include = xml->getNode("include"); if(include) { @@ -456,7 +456,7 @@ CURLcode NetworkHttp::loadAddonsList(const XMLNode *xml, { std::string xml_file = file_manager->getAddonsFile("addons.xml"); if(download) - UserConfigParams::m_addons_last_updated=Time::getTimeSinceEpoch(); + UserConfigParams::m_addons_last_updated=StkTime::getTimeSinceEpoch(); const XMLNode *xml = new XMLNode(xml_file); addons_manager->initOnline(xml); if(UserConfigParams::logAddons()) diff --git a/src/addons/news_manager.cpp b/src/addons/news_manager.cpp index eb75f7abd..5f70e4f92 100644 --- a/src/addons/news_manager.cpp +++ b/src/addons/news_manager.cpp @@ -50,7 +50,7 @@ NewsManager::~NewsManager() */ void NewsManager::init() { - UserConfigParams::m_news_last_updated = Time::getTimeSinceEpoch(); + UserConfigParams::m_news_last_updated = StkTime::getTimeSinceEpoch(); std::string xml_file = file_manager->getAddonsFile("news.xml"); const XMLNode *xml = new XMLNode(xml_file); diff --git a/src/config/player.cpp b/src/config/player.cpp index dacbcc19d..542d56972 100644 --- a/src/config/player.cpp +++ b/src/config/player.cpp @@ -79,7 +79,7 @@ void PlayerProfile::incrementUseFrequency() //------------------------------------------------------------------------------ int64_t PlayerProfile::generateUniqueId(const char* playerName) { - return ((int64_t)(Time::getTimeSinceEpoch()) << 32) | + return ((int64_t)(StkTime::getTimeSinceEpoch()) << 32) | ((rand() << 16) & 0xFFFF0000) | (StringUtils::simpleHash(playerName) & 0xFFFF); } diff --git a/src/config/user_config.cpp b/src/config/user_config.cpp index d4f11a16a..a2587ba2e 100644 --- a/src/config/user_config.cpp +++ b/src/config/user_config.cpp @@ -242,7 +242,7 @@ void IntUserConfigParam::findYourDataInAnAttributeOf(const XMLNode* node) } // findYourDataInAnAttributeOf // ============================================================================ -TimeUserConfigParam::TimeUserConfigParam(Time::TimeType default_value, +TimeUserConfigParam::TimeUserConfigParam(StkTime::TimeType default_value, const char* param_name, const char* comment) { @@ -254,7 +254,7 @@ TimeUserConfigParam::TimeUserConfigParam(Time::TimeType default_value, } // TimeUserConfigParam // ---------------------------------------------------------------------------- -TimeUserConfigParam::TimeUserConfigParam(Time::TimeType default_value, +TimeUserConfigParam::TimeUserConfigParam(StkTime::TimeType default_value, const char* param_name, GroupUserConfigParam* group, const char* comment) diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index be1912c15..9a1c9c11d 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -132,14 +132,14 @@ public: // ============================================================================ class TimeUserConfigParam : public UserConfigParam { - Time::TimeType m_value; - Time::TimeType m_default_value; + StkTime::TimeType m_value; + StkTime::TimeType m_default_value; public: - TimeUserConfigParam(Time::TimeType default_value, const char* param_name, + TimeUserConfigParam(StkTime::TimeType default_value, const char* param_name, const char* comment = NULL); - TimeUserConfigParam(Time::TimeType default_value, const char* param_name, + TimeUserConfigParam(StkTime::TimeType default_value, const char* param_name, GroupUserConfigParam* group, const char* comment=NULL); void write(XMLWriter& stream) const; @@ -148,10 +148,10 @@ public: irr::core::stringw toString() const; void revertToDefaults() { m_value = m_default_value; } - operator Time::TimeType() const { return m_value; } - Time::TimeType& operator=(const Time::TimeType& v) + operator StkTime::TimeType() const { return m_value; } + StkTime::TimeType& operator=(const StkTime::TimeType& v) { m_value = v; return m_value; } - Time::TimeType& operator=(const TimeUserConfigParam& v) + StkTime::TimeType& operator=(const TimeUserConfigParam& v) { m_value = (int)v; return m_value; } }; // TimeUserConfigParam diff --git a/src/guiengine/widgets/CGUIEditBox.cpp b/src/guiengine/widgets/CGUIEditBox.cpp index cc548d655..264f8cf48 100644 --- a/src/guiengine/widgets/CGUIEditBox.cpp +++ b/src/guiengine/widgets/CGUIEditBox.cpp @@ -26,9 +26,9 @@ */ -Time::TimeType getTime() +StkTime::TimeType getTime() { - return Time::getTimeSinceEpoch(); + return StkTime::getTimeSinceEpoch(); } //! constructor diff --git a/src/guiengine/widgets/CGUIEditBox.h b/src/guiengine/widgets/CGUIEditBox.h index c2cf7c5aa..763780c9a 100644 --- a/src/guiengine/widgets/CGUIEditBox.h +++ b/src/guiengine/widgets/CGUIEditBox.h @@ -149,7 +149,7 @@ using namespace gui; gui::IGUIFont *OverrideFont, *LastBreakFont; IOSOperator* Operator; - Time::TimeType BlinkStartTime; + StkTime::TimeType BlinkStartTime; s32 CursorPos; s32 HScrollPos, VScrollPos; // scroll position in characters u32 Max; diff --git a/src/io/file_manager.cpp b/src/io/file_manager.cpp index 714912ee9..478c13f1f 100644 --- a/src/io/file_manager.cpp +++ b/src/io/file_manager.cpp @@ -244,7 +244,7 @@ FileManager::~FileManager() } struct stat mystat; stat(full_path.c_str(), &mystat); - Time::TimeType current = Time::getTimeSinceEpoch(); + StkTime::TimeType current = StkTime::getTimeSinceEpoch(); if(current - mystat.st_ctime <24*3600) { if(UserConfigParams::logAddons()) diff --git a/src/modes/cutscene_world.cpp b/src/modes/cutscene_world.cpp index ab56220d9..d0361ef8c 100644 --- a/src/modes/cutscene_world.cpp +++ b/src/modes/cutscene_world.cpp @@ -198,7 +198,7 @@ void CutsceneWorld::update(float dt) curr->reset(); } m_time = 0.01f; - m_time_at_second_reset = Time::getRealTime(); + m_time_at_second_reset = StkTime::getRealTime(); m_second_reset = true; } else if (m_second_reset) @@ -213,7 +213,7 @@ void CutsceneWorld::update(float dt) } //m_time_at_second_reset = m_time; - m_time_at_second_reset = Time::getRealTime(); + m_time_at_second_reset = StkTime::getRealTime(); m_time = 0.01f; } else @@ -221,7 +221,7 @@ void CutsceneWorld::update(float dt) // this way of calculating time and dt is more in line with what // irrlicht does andprovides better synchronisation double prev_time = m_time; - double now = Time::getRealTime(); + double now = StkTime::getRealTime(); m_time = now - m_time_at_second_reset; dt = (float)(m_time - prev_time); } diff --git a/src/states_screens/addons_screen.cpp b/src/states_screens/addons_screen.cpp index 20b717dcf..9e4b3250d 100644 --- a/src/states_screens/addons_screen.cpp +++ b/src/states_screens/addons_screen.cpp @@ -209,8 +209,8 @@ void AddonsScreen::loadList() GUIEngine::SpinnerWidget* w_filter_date = getWidget("filter_date"); int date_index = w_filter_date->getValue(); - Time::TimeType date = Time::getTimeSinceEpoch(); - date = Time::addInterval(date, + StkTime::TimeType date = StkTime::getTimeSinceEpoch(); + date = StkTime::addInterval(date, -m_date_filters[date_index].year, -m_date_filters[date_index].month, -m_date_filters[date_index].day); @@ -242,7 +242,7 @@ void AddonsScreen::loadList() continue; // Filter by date. - if (date_index != 0 && Time::compareTime(date, addon.getDate()) > 0) + if (date_index != 0 && StkTime::compareTime(date, addon.getDate()) > 0) continue; // Filter by name, designer and description. diff --git a/src/utils/time.cpp b/src/utils/time.cpp index 3c1dfe89b..de032b412 100644 --- a/src/utils/time.cpp +++ b/src/utils/time.cpp @@ -23,7 +23,7 @@ * time of the application, 1.1.1970, ...). * The value is a double precision floating point value in seconds. */ -double Time::getRealTime(long startAt) +double StkTime::getRealTime(long startAt) { return irr_driver->getRealTime()/1000.0; } // getTimeSinceEpoch diff --git a/src/utils/time.hpp b/src/utils/time.hpp index 477d00907..e2b660bce 100644 --- a/src/utils/time.hpp +++ b/src/utils/time.hpp @@ -31,7 +31,7 @@ #include -class Time +class StkTime { public: typedef time_t TimeType;