Removal and Replacement of the CryTimer (gEnv->pTimer) (#5409)
Replaced and removed the CryTimer (gEnv->pTimer). The new TimeSystem is a merger of the current time functionality found in the engine.
* Rename TimeSystemComponent.h/.cpp to TimeSystem.h/.cpp
* Adding New TimeSystem
* remove old timer cvars
* small improvements to the time system.
- updated parts to use the time conversion functions.
- in AdvanceTickDeltaTimes applying t_simulationTickScale is now uses doubles instead of floats.
* Replace gEnv->pTimer / ITimer usages with TimeSystem
* Updating usages of AZ::TimeMs{ 0 } and AZ::TimeUs{ 0 } to AZ::Time::ZeroTimeMs and AZ::Time::ZeroTimeUs
* red code the CryTimer
* using TimeUs instead of TimeMs is some cases + updating usages of old cvars to new
Signed-off-by: amzn-sean <75276488+amzn-sean@users.noreply.github.com>
This commit is contained in:
@@ -136,6 +136,44 @@ static const char* PLATFORM_INDEPENDENT_LANGUAGE_NAMES[ ILocalizationManager::eP
|
||||
"da-DK" // Danish (Denmark)
|
||||
};
|
||||
|
||||
#if defined(WIN32) || defined(WIN64)
|
||||
namespace
|
||||
{
|
||||
#if defined(WIN32)
|
||||
time_t gmt_to_local_win32(void)
|
||||
{
|
||||
TIME_ZONE_INFORMATION tzinfo;
|
||||
DWORD dwStandardDaylight;
|
||||
long bias;
|
||||
|
||||
dwStandardDaylight = GetTimeZoneInformation(&tzinfo);
|
||||
bias = tzinfo.Bias;
|
||||
|
||||
if (dwStandardDaylight == TIME_ZONE_ID_STANDARD)
|
||||
{
|
||||
bias += tzinfo.StandardBias;
|
||||
}
|
||||
|
||||
if (dwStandardDaylight == TIME_ZONE_ID_DAYLIGHT)
|
||||
{
|
||||
bias += tzinfo.DaylightBias;
|
||||
}
|
||||
|
||||
return (-bias * 60);
|
||||
}
|
||||
#endif // #if defined(WIN32)
|
||||
|
||||
time_t DateToSecondsUTC(struct tm& inDate)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
return mktime(&inDate) + gmt_to_local_win32();
|
||||
#else
|
||||
return mktime(&inDate);
|
||||
#endif // #if defined(WIN32)
|
||||
}
|
||||
}
|
||||
#endif // #if defined(WIN32) || defined(WIN64)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(_RELEASE)
|
||||
static void ReloadDialogData([[maybe_unused]] IConsoleCmdArgs* pArgs)
|
||||
@@ -2656,7 +2694,7 @@ void CLocalizedStringsManager::LocalizeTime(time_t t, bool bMakeLocalTime, bool
|
||||
{
|
||||
struct tm thetime;
|
||||
localtime_s(&thetime, &t);
|
||||
t = gEnv->pTimer->DateToSecondsUTC(thetime);
|
||||
t = DateToSecondsUTC(thetime);
|
||||
}
|
||||
outTimeString.clear();
|
||||
LCID lcID = g_currentLanguageID.lcID ? g_currentLanguageID.lcID : LOCALE_USER_DEFAULT;
|
||||
@@ -2680,7 +2718,7 @@ void CLocalizedStringsManager::LocalizeDate(time_t t, bool bMakeLocalTime, bool
|
||||
{
|
||||
struct tm thetime;
|
||||
localtime_s(&thetime, &t);
|
||||
t = gEnv->pTimer->DateToSecondsUTC(thetime);
|
||||
t = DateToSecondsUTC(thetime);
|
||||
}
|
||||
outDateString.resize(0);
|
||||
LCID lcID = g_currentLanguageID.lcID ? g_currentLanguageID.lcID : LOCALE_USER_DEFAULT;
|
||||
|
||||
Reference in New Issue
Block a user