Skip to content

Commit

Permalink
очистка TimeSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
VigersRay committed Jun 23, 2024
1 parent ff4c94d commit 43c12d3
Showing 1 changed file with 13 additions and 39 deletions.
52 changes: 13 additions & 39 deletions Content.Client/_Sunrise/Time/TimeSystem.cs
Original file line number Diff line number Diff line change
@@ -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<TickerLobbyStatusEvent>(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");
}
}
public string GetDate()
{
return DateTime.UtcNow.AddYears(1000).ToString("dd.MM.yyyy");
}
}

0 comments on commit 43c12d3

Please sign in to comment.