Innovenergy_trunk/csharp/Lib/Time/Unix/UnixTime.Converters.cs

9 lines
374 B
C#
Raw Normal View History

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);
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
}