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

20 lines
1.1 KiB
C#
Raw Normal View History

2023-02-16 12:57:06 +00:00
namespace InnovEnergy.Time.Unix;
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);
}