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:
amzn-sean
2021-11-15 12:11:58 +00:00
committed by GitHub
parent 0ada8b335b
commit 38a03817bb
142 changed files with 1215 additions and 2090 deletions
@@ -12,7 +12,7 @@
#include <Multiplayer/NetworkTime/RewindableObject.h>
#include <Source/NetworkTime/NetworkTime.h>
#include <AzCore/Console/LoggerSystemComponent.h>
#include <AzCore/Time/TimeSystemComponent.h>
#include <AzCore/Time/TimeSystem.h>
#include <AzCore/UnitTest/TestTypes.h>
namespace UnitTest
@@ -23,7 +23,7 @@ namespace UnitTest
public:
Multiplayer::NetworkTime m_networkTime;
AZ::LoggerSystemComponent m_loggerComponent;
AZ::TimeSystemComponent m_timeComponent;
AZ::TimeSystem m_timeSystem;
};
static constexpr uint32_t RewindableContainerSize = 7;
@@ -43,7 +43,7 @@ namespace UnitTest
// Test rewind for all pushed values and overall size
for (uint32_t idx = 0; idx < RewindableContainerSize; ++idx)
{
Multiplayer::ScopedAlterTime time(static_cast<Multiplayer::HostFrameId>(idx), AZ::TimeMs{ 0 }, 1.f, AzNetworking::InvalidConnectionId);
Multiplayer::ScopedAlterTime time(static_cast<Multiplayer::HostFrameId>(idx), AZ::Time::ZeroTimeMs, 1.f, AzNetworking::InvalidConnectionId);
EXPECT_EQ(idx + 1, test.size());
EXPECT_EQ(idx, test.back());
}
@@ -70,9 +70,9 @@ namespace UnitTest
EXPECT_TRUE(test.empty());
// Test rewind for pop_back and clear
Multiplayer::ScopedAlterTime pop_time(static_cast<Multiplayer::HostFrameId>(RewindableContainerSize), AZ::TimeMs{ 0 }, 1.f, AzNetworking::InvalidConnectionId);
Multiplayer::ScopedAlterTime pop_time(static_cast<Multiplayer::HostFrameId>(RewindableContainerSize), AZ::Time::ZeroTimeMs, 1.f, AzNetworking::InvalidConnectionId);
EXPECT_EQ(RewindableContainerSize - 1, test.size());
Multiplayer::ScopedAlterTime clear_time(static_cast<Multiplayer::HostFrameId>(RewindableContainerSize + 1), AZ::TimeMs{ 0 }, 1.f, AzNetworking::InvalidConnectionId);
Multiplayer::ScopedAlterTime clear_time(static_cast<Multiplayer::HostFrameId>(RewindableContainerSize + 1), AZ::Time::ZeroTimeMs, 1.f, AzNetworking::InvalidConnectionId);
EXPECT_EQ(0, test.size());
// Test copy_values and resize_no_construct
@@ -100,7 +100,7 @@ namespace UnitTest
// Test rewind for all values and overall size
for (uint32_t idx = 1; idx <= RewindableContainerSize; ++idx)
{
Multiplayer::ScopedAlterTime time(static_cast<Multiplayer::HostFrameId>(idx), AZ::TimeMs{ 0 }, 1.f, AzNetworking::InvalidConnectionId);
Multiplayer::ScopedAlterTime time(static_cast<Multiplayer::HostFrameId>(idx), AZ::Time::ZeroTimeMs, 1.f, AzNetworking::InvalidConnectionId);
for (uint32_t testIdx = 0; testIdx < RewindableContainerSize; ++testIdx)
{
if (testIdx < idx)