-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |