From 96570b0eb33d08f02fc92c5fa08e47f5c75fe4f8 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 4 May 2025 16:06:39 +0100 Subject: [PATCH] Fixed `GetInRaidTime` ignored passed in value Improved accuracy of time simulation --- .../SPTarkov.Server.Core/Helpers/WeatherHelper.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs index 34158f92..6fbd5ebc 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs @@ -34,15 +34,17 @@ public class WeatherHelper( public DateTime GetInRaidTime(long timestamp) { // tarkov time = (real time * 7 % 24 hr) + 3 hour - var russiaOffsetMilliseconds = _timeUtil.GetHoursAsSeconds(3) * 1000; - var twentyFourHoursMilliseconds = _timeUtil.GetHoursAsSeconds(24) * 1000; - var currentTimestampMilliSeconds = _timeUtil.GetTimeStamp(); + var russiaOffsetSeconds = _timeUtil.GetHoursAsSeconds(3); + var twentyFourHoursSeconds = _timeUtil.GetHoursAsSeconds(24); + var currentTimestampSeconds = timestamp; - return _timeUtil.GetDateTimeFromTimeStamp( + var tarkovTime = _timeUtil.GetDateTimeFromTimeStamp( (long) - (russiaOffsetMilliseconds + currentTimestampMilliSeconds * _weatherConfig.Acceleration) % - twentyFourHoursMilliseconds + (russiaOffsetSeconds + currentTimestampSeconds * _weatherConfig.Acceleration) % + twentyFourHoursSeconds ); + + return tarkovTime; } ///