2023-02-25 14:53:58 +00:00
|
|
|
namespace InnovEnergy.Lib.Time.Unix;
|
2023-02-16 12:57:06 +00:00
|
|
|
|
|
|
|
public readonly partial struct UnixTime
|
|
|
|
{
|
|
|
|
public DateTime ToUtcDateTime() => DateTime.UnixEpoch + TimeSpan.FromSeconds(Ticks);
|
2023-03-20 12:25:19 +00:00
|
|
|
|
|
|
|
public static implicit operator DateTime(UnixTime unixTimeSpan) => unixTimeSpan.ToUtcDateTime();
|
|
|
|
public static implicit operator UnixTime(DateTime dateTime) => FromUtcDateTime(dateTime);
|
2023-02-16 12:57:06 +00:00
|
|
|
}
|