From 43c12d39d78efaddb20bab61c3ac1e14a33370bf Mon Sep 17 00:00:00 2001 From: VigersRay Date: Mon, 24 Jun 2024 00:12:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20Ti?= =?UTF-8?q?meSystem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Client/_Sunrise/Time/TimeSystem.cs | 52 ++++++---------------- 1 file changed, 13 insertions(+), 39 deletions(-) diff --git a/Content.Client/_Sunrise/Time/TimeSystem.cs b/Content.Client/_Sunrise/Time/TimeSystem.cs index f5e2943b1f3..d22ebc82a47 100644 --- a/Content.Client/_Sunrise/Time/TimeSystem.cs +++ b/Content.Client/_Sunrise/Time/TimeSystem.cs @@ -1,48 +1,22 @@ -using Content.Shared.Examine; -using Content.Shared.GameTicking; -using Robust.Shared.Timing; -using System; - namespace Content.Client._Sunrise.Time; public sealed class TimeSystem : EntitySystem { - [Dependency] private readonly IGameTiming _timing = default!; - - private TimeSpan _roundStart; - - public override void Initialize() + public (TimeSpan Time, int Date) GetStationTime() { - base.Initialize(); - SubscribeNetworkEvent(LobbyStatus); - } + var moscowTime = DateTime.UtcNow + TimeSpan.FromHours(3); + var stationTime = moscowTime.TimeOfDay; - private void LobbyStatus(TickerLobbyStatusEvent ev) - { - _roundStart = ev.RoundStartTimeSpan; - } + var daysPassed = (int)stationTime.TotalHours / 24; + stationTime = stationTime.Subtract(TimeSpan.FromHours(daysPassed * 24)); - public (TimeSpan Time, int Date) GetStationTime() - { - var moscowTime = DateTime.UtcNow + TimeSpan.FromHours(3); - var stationTime = moscowTime.TimeOfDay; + var date = 13 + daysPassed; - var daysPassed = (int)stationTime.TotalHours / 24; - stationTime = stationTime.Subtract(TimeSpan.FromHours(daysPassed * 24)); - - var date = 13 + daysPassed; - - return (stationTime, date); - } - - public TimeSpan GetCurrentServerTime() - { - var moscowTime = DateTime.UtcNow + TimeSpan.FromHours(3); - return moscowTime.TimeOfDay; - } + return (stationTime, date); + } - public string GetDate() - { - return DateTime.Now.AddYears(1000).ToString("dd.MM.yyyy"); - } -} \ No newline at end of file + public string GetDate() + { + return DateTime.UtcNow.AddYears(1000).ToString("dd.MM.yyyy"); + } +}