using System;
using ACE.Common;
namespace ACE.Server.Entity
{
public static class Timers
{
///
/// DateTime.UtcNow at the time the server started.
///
public static DateTime WorldStartTime { get; } = DateTime.UtcNow;
///
/// DateTime.UtcNow
///
public static DateTime CurrentTime => DateTime.UtcNow;
///
/// (CurrentTime - WorldStartTime).TotalSeconds
/// This value has 1ms precision.
///
public static double RunningTime => (CurrentTime - WorldStartTime).TotalSeconds;
///
/// DerethDateTime.UtcNowToEMUTime at the time the server started.
///
public static DerethDateTime WorldStartLoreTime { get; } = DerethDateTime.UtcNowToEMUTime;
///
/// Returns DerethDateTime.UtcNowToLoreTime
///
public static DerethDateTime CurrentLoreTime => DerethDateTime.UtcNowToLoreTime;
///
/// Returns current in game time, as seen on Map Panel, calculated from PortalYearTicks
///
public static DerethDateTime CurrentInGameTime => new DerethDateTime(PortalYearTicks);
///
/// This is the current Portal Year time, in seconds.
/// It is updated once per WorldManager.UpdateWorld() loop.
/// This can also be used as the "frame time" value. This value will be unchanged for any calculations done inside of a single Tick of WorldManager.UpdateWorld().
///
public static double PortalYearTicks { get; internal set; } = Timers.WorldStartLoreTime.Ticks;
}
}