From 71642a24bfaffc5ddc30607c721d7ceca3eb7971 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Wed, 12 Jun 2024 19:15:11 -0700 Subject: [PATCH] is this what you wanted --- dGame/dComponents/RacingControlComponent.cpp | 4 ++-- dGame/dComponents/RacingControlComponent.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dGame/dComponents/RacingControlComponent.cpp b/dGame/dComponents/RacingControlComponent.cpp index a5454d9d..17b3089d 100644 --- a/dGame/dComponents/RacingControlComponent.cpp +++ b/dGame/dComponents/RacingControlComponent.cpp @@ -828,8 +828,8 @@ void RacingControlComponent::Update(float deltaTime) { // Reached the start point, lapped if (respawnIndex == 0) { - auto now = std::chrono::high_resolution_clock::now(); - auto lapTime = std::chrono::duration_cast(now - (player.lap == 0 ? m_StartTime : player.lapTime)); + const auto now = std::chrono::high_resolution_clock::now(); + const auto lapTime = std::chrono::duration_cast(now - (player.lap == 0 ? m_StartTime : player.lapTime)); // Cheating check if (lapTime.count() < 40000) { diff --git a/dGame/dComponents/RacingControlComponent.h b/dGame/dComponents/RacingControlComponent.h index 01526e74..43c7e158 100644 --- a/dGame/dComponents/RacingControlComponent.h +++ b/dGame/dComponents/RacingControlComponent.h @@ -78,7 +78,7 @@ struct RacingPlayerInfo { /** * The current lap time of the player */ - std::chrono::system_clock::time_point lapTime; + std::chrono::high_resolution_clock::time_point lapTime; /** * The number of times this player smashed their car @@ -232,7 +232,7 @@ private: /** * The time the race was started */ - std::chrono::system_clock::time_point m_StartTime; + std::chrono::high_resolution_clock::time_point m_StartTime; /** * Timer for tracking how long a player was alone in this race