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

20 lines
1.2 KiB
C#
Raw Normal View History

namespace InnovEnergy.Lib.Time.Unix;
2023-02-16 12:57:06 +00:00
public readonly partial struct UnixTime
{
public static UnixTime operator -(UnixTime a, UnixTimeSpan b) => FromTicks(a.Ticks - b.Ticks);
public static UnixTime operator +(UnixTime a, UnixTimeSpan b) => FromTicks(a.Ticks + b.Ticks);
public static UnixTime operator +(UnixTimeSpan a, UnixTime b) => FromTicks(a.Ticks + b.Ticks);
public static UInt32 operator /(UnixTime a, UnixTimeSpan b) => a.Ticks / b.Ticks;
public static UInt32 operator %(UnixTime a, UnixTimeSpan b) => a.Ticks % b.Ticks;
public static Boolean operator < (UnixTime l, UnixTime r) => l.Ticks < r.Ticks;
public static Boolean operator > (UnixTime l, UnixTime r) => l.Ticks > r.Ticks;
public static Boolean operator <= (UnixTime l, UnixTime r) => l.Ticks <= r.Ticks;
public static Boolean operator >= (UnixTime l, UnixTime r) => l.Ticks >= r.Ticks;
public static Boolean operator == (UnixTime l, UnixTime r) => l.Ticks == r.Ticks;
public static Boolean operator != (UnixTime l, UnixTime r) => l.Ticks != r.Ticks;
public static UnixTimeSpan operator -(UnixTime a, UnixTime b) => UnixTimeSpan.FromTicks(a.Ticks - b.Ticks);
}