9 lines
374 B
C#
9 lines
374 B
C#
namespace InnovEnergy.Lib.Time.Unix;
|
|
|
|
public readonly partial struct UnixTime
|
|
{
|
|
public DateTime ToUtcDateTime() => DateTime.UnixEpoch + TimeSpan.FromSeconds(Ticks);
|
|
|
|
public static implicit operator DateTime(UnixTime unixTimeSpan) => unixTimeSpan.ToUtcDateTime();
|
|
public static implicit operator UnixTime(DateTime dateTime) => FromUtcDateTime(dateTime);
|
|
} |