namespace InnovEnergy.Time.Unix; public readonly partial struct UnixTime { private UnixTime(UInt32 ticks) => Ticks = ticks; public static UnixTime FromTicks(UInt32 ticks) => new UnixTime(ticks); public static UnixTime FromTicks(Int32 ticks) => new UnixTime((UInt32) ticks); public static UnixTime FromUtcDateTime(DateTime dateTime) { var timeSinceEpoch = dateTime - DateTime.UnixEpoch; var ticks = (UInt32) timeSinceEpoch.TotalSeconds; return new UnixTime(ticks); } public static UnixTime Epoch => new UnixTime(0); public static UnixTime Now => FromUtcDateTime(DateTime.UtcNow); }