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
This commit is contained in:
curaga 2013-08-30 12:24:12 +00:00
parent 2a6c1a0a8f
commit efe3b59bc5
14 changed files with 31 additions and 31 deletions

View File

@ -162,7 +162,7 @@ void Addon::writeXML(std::ofstream *out_stream)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
std::string Addon::getDateAsString() const std::string Addon::getDateAsString() const
{ {
return Time::toString(m_date); return StkTime::toString(m_date);
} // getDateAsString } // getDateAsString
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -99,7 +99,7 @@ private:
* in the addons.xml file. */ * in the addons.xml file. */
bool m_still_exists; bool m_still_exists;
/** Date when the addon was added. */ /** Date when the addon was added. */
Time::TimeType m_date; StkTime::TimeType m_date;
/** A description of this addon. */ /** A description of this addon. */
core::stringw m_description; core::stringw m_description;
/** The URL of the icon (relative to the server) */ /** 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 /** Returns the date (in seconds since epoch) when the addon was
* uploaded. */ * uploaded. */
Time::TimeType getDate() const { return m_date; } StkTime::TimeType getDate() const { return m_date; }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Returns a user readable date as a string. */ /** Returns a user readable date as a string. */
std::string getDateAsString() const; std::string getDateAsString() const;

View File

@ -270,7 +270,7 @@ CURLcode NetworkHttp::init(bool forceRefresh)
bool download = UserConfigParams::m_news_last_updated==0 || bool download = UserConfigParams::m_news_last_updated==0 ||
UserConfigParams::m_news_last_updated UserConfigParams::m_news_last_updated
+UserConfigParams::m_news_frequency +UserConfigParams::m_news_frequency
< Time::getTimeSinceEpoch() || forceRefresh; < StkTime::getTimeSinceEpoch() || forceRefresh;
if(!download) if(!download)
{ {
@ -303,7 +303,7 @@ CURLcode NetworkHttp::init(bool forceRefresh)
{ {
std::string xml_file = file_manager->getAddonsFile("news.xml"); std::string xml_file = file_manager->getAddonsFile("news.xml");
if(download) if(download)
UserConfigParams::m_news_last_updated = Time::getTimeSinceEpoch(); UserConfigParams::m_news_last_updated = StkTime::getTimeSinceEpoch();
const XMLNode *xml = new XMLNode(xml_file); const XMLNode *xml = new XMLNode(xml_file);
// A proper news file has at least a version number, mtime, and // A proper news file has at least a version number, mtime, and
@ -319,7 +319,7 @@ CURLcode NetworkHttp::init(bool forceRefresh)
status = downloadFileInternal(&r); status = downloadFileInternal(&r);
if(status==CURLE_OK) if(status==CURLE_OK)
UserConfigParams::m_news_last_updated = UserConfigParams::m_news_last_updated =
Time::getTimeSinceEpoch(); StkTime::getTimeSinceEpoch();
delete xml; delete xml;
xml = new XMLNode(xml_file); xml = new XMLNode(xml_file);
} }
@ -416,7 +416,7 @@ CURLcode NetworkHttp::loadAddonsList(const XMLNode *xml,
bool forceRefresh) bool forceRefresh)
{ {
std::string addon_list_url(""); std::string addon_list_url("");
Time::TimeType mtime(0); StkTime::TimeType mtime(0);
const XMLNode *include = xml->getNode("include"); const XMLNode *include = xml->getNode("include");
if(include) if(include)
{ {
@ -456,7 +456,7 @@ CURLcode NetworkHttp::loadAddonsList(const XMLNode *xml,
{ {
std::string xml_file = file_manager->getAddonsFile("addons.xml"); std::string xml_file = file_manager->getAddonsFile("addons.xml");
if(download) if(download)
UserConfigParams::m_addons_last_updated=Time::getTimeSinceEpoch(); UserConfigParams::m_addons_last_updated=StkTime::getTimeSinceEpoch();
const XMLNode *xml = new XMLNode(xml_file); const XMLNode *xml = new XMLNode(xml_file);
addons_manager->initOnline(xml); addons_manager->initOnline(xml);
if(UserConfigParams::logAddons()) if(UserConfigParams::logAddons())

View File

@ -50,7 +50,7 @@ NewsManager::~NewsManager()
*/ */
void NewsManager::init() 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"); std::string xml_file = file_manager->getAddonsFile("news.xml");
const XMLNode *xml = new XMLNode(xml_file); const XMLNode *xml = new XMLNode(xml_file);

View File

@ -79,7 +79,7 @@ void PlayerProfile::incrementUseFrequency()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int64_t PlayerProfile::generateUniqueId(const char* playerName) int64_t PlayerProfile::generateUniqueId(const char* playerName)
{ {
return ((int64_t)(Time::getTimeSinceEpoch()) << 32) | return ((int64_t)(StkTime::getTimeSinceEpoch()) << 32) |
((rand() << 16) & 0xFFFF0000) | ((rand() << 16) & 0xFFFF0000) |
(StringUtils::simpleHash(playerName) & 0xFFFF); (StringUtils::simpleHash(playerName) & 0xFFFF);
} }

View File

@ -242,7 +242,7 @@ void IntUserConfigParam::findYourDataInAnAttributeOf(const XMLNode* node)
} // findYourDataInAnAttributeOf } // findYourDataInAnAttributeOf
// ============================================================================ // ============================================================================
TimeUserConfigParam::TimeUserConfigParam(Time::TimeType default_value, TimeUserConfigParam::TimeUserConfigParam(StkTime::TimeType default_value,
const char* param_name, const char* param_name,
const char* comment) const char* comment)
{ {
@ -254,7 +254,7 @@ TimeUserConfigParam::TimeUserConfigParam(Time::TimeType default_value,
} // TimeUserConfigParam } // TimeUserConfigParam
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
TimeUserConfigParam::TimeUserConfigParam(Time::TimeType default_value, TimeUserConfigParam::TimeUserConfigParam(StkTime::TimeType default_value,
const char* param_name, const char* param_name,
GroupUserConfigParam* group, GroupUserConfigParam* group,
const char* comment) const char* comment)

View File

@ -132,14 +132,14 @@ public:
// ============================================================================ // ============================================================================
class TimeUserConfigParam : public UserConfigParam class TimeUserConfigParam : public UserConfigParam
{ {
Time::TimeType m_value; StkTime::TimeType m_value;
Time::TimeType m_default_value; StkTime::TimeType m_default_value;
public: public:
TimeUserConfigParam(Time::TimeType default_value, const char* param_name, TimeUserConfigParam(StkTime::TimeType default_value, const char* param_name,
const char* comment = NULL); 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); GroupUserConfigParam* group, const char* comment=NULL);
void write(XMLWriter& stream) const; void write(XMLWriter& stream) const;
@ -148,10 +148,10 @@ public:
irr::core::stringw toString() const; irr::core::stringw toString() const;
void revertToDefaults() { m_value = m_default_value; } void revertToDefaults() { m_value = m_default_value; }
operator Time::TimeType() const { return m_value; } operator StkTime::TimeType() const { return m_value; }
Time::TimeType& operator=(const Time::TimeType& v) StkTime::TimeType& operator=(const StkTime::TimeType& v)
{ m_value = v; return m_value; } { 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; } { m_value = (int)v; return m_value; }
}; // TimeUserConfigParam }; // TimeUserConfigParam

View File

@ -26,9 +26,9 @@
*/ */
Time::TimeType getTime() StkTime::TimeType getTime()
{ {
return Time::getTimeSinceEpoch(); return StkTime::getTimeSinceEpoch();
} }
//! constructor //! constructor

View File

@ -149,7 +149,7 @@ using namespace gui;
gui::IGUIFont *OverrideFont, *LastBreakFont; gui::IGUIFont *OverrideFont, *LastBreakFont;
IOSOperator* Operator; IOSOperator* Operator;
Time::TimeType BlinkStartTime; StkTime::TimeType BlinkStartTime;
s32 CursorPos; s32 CursorPos;
s32 HScrollPos, VScrollPos; // scroll position in characters s32 HScrollPos, VScrollPos; // scroll position in characters
u32 Max; u32 Max;

View File

@ -244,7 +244,7 @@ FileManager::~FileManager()
} }
struct stat mystat; struct stat mystat;
stat(full_path.c_str(), &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(current - mystat.st_ctime <24*3600)
{ {
if(UserConfigParams::logAddons()) if(UserConfigParams::logAddons())

View File

@ -198,7 +198,7 @@ void CutsceneWorld::update(float dt)
curr->reset(); curr->reset();
} }
m_time = 0.01f; m_time = 0.01f;
m_time_at_second_reset = Time::getRealTime(); m_time_at_second_reset = StkTime::getRealTime();
m_second_reset = true; m_second_reset = true;
} }
else if (m_second_reset) 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 = m_time;
m_time_at_second_reset = Time::getRealTime(); m_time_at_second_reset = StkTime::getRealTime();
m_time = 0.01f; m_time = 0.01f;
} }
else else
@ -221,7 +221,7 @@ void CutsceneWorld::update(float dt)
// this way of calculating time and dt is more in line with what // this way of calculating time and dt is more in line with what
// irrlicht does andprovides better synchronisation // irrlicht does andprovides better synchronisation
double prev_time = m_time; double prev_time = m_time;
double now = Time::getRealTime(); double now = StkTime::getRealTime();
m_time = now - m_time_at_second_reset; m_time = now - m_time_at_second_reset;
dt = (float)(m_time - prev_time); dt = (float)(m_time - prev_time);
} }

View File

@ -209,8 +209,8 @@ void AddonsScreen::loadList()
GUIEngine::SpinnerWidget* w_filter_date = GUIEngine::SpinnerWidget* w_filter_date =
getWidget<GUIEngine::SpinnerWidget>("filter_date"); getWidget<GUIEngine::SpinnerWidget>("filter_date");
int date_index = w_filter_date->getValue(); int date_index = w_filter_date->getValue();
Time::TimeType date = Time::getTimeSinceEpoch(); StkTime::TimeType date = StkTime::getTimeSinceEpoch();
date = Time::addInterval(date, date = StkTime::addInterval(date,
-m_date_filters[date_index].year, -m_date_filters[date_index].year,
-m_date_filters[date_index].month, -m_date_filters[date_index].month,
-m_date_filters[date_index].day); -m_date_filters[date_index].day);
@ -242,7 +242,7 @@ void AddonsScreen::loadList()
continue; continue;
// Filter by date. // Filter by date.
if (date_index != 0 && Time::compareTime(date, addon.getDate()) > 0) if (date_index != 0 && StkTime::compareTime(date, addon.getDate()) > 0)
continue; continue;
// Filter by name, designer and description. // Filter by name, designer and description.

View File

@ -23,7 +23,7 @@
* time of the application, 1.1.1970, ...). * time of the application, 1.1.1970, ...).
* The value is a double precision floating point value in seconds. * 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; return irr_driver->getRealTime()/1000.0;
} // getTimeSinceEpoch } // getTimeSinceEpoch

View File

@ -31,7 +31,7 @@
#include <string> #include <string>
class Time class StkTime
{ {
public: public:
typedef time_t TimeType; typedef time_t TimeType;