support UnixTime in Units
This commit is contained in:
parent
2738fe5aab
commit
1b9353b1db
|
@ -20,7 +20,7 @@ public readonly partial struct UnixTimeSpan
|
|||
|
||||
public static UnixTimeSpan operator /(UnixTimeSpan a, UInt32 b) => new UnixTimeSpan(a.Ticks / b);
|
||||
public static UnixTimeSpan operator /(UnixTimeSpan a, Int32 b) => new UnixTimeSpan(a.Ticks / (UInt32)b);
|
||||
public static UInt32 operator /(UnixTimeSpan a, UnixTimeSpan b) => a.Ticks / b.Ticks;
|
||||
public static UInt32 operator /(UnixTimeSpan a, UnixTimeSpan b) => a.Ticks / b.Ticks;
|
||||
|
||||
public static UnixTimeSpan operator %(UnixTimeSpan a, UInt32 b) => new UnixTimeSpan(a.Ticks % b);
|
||||
public static UnixTimeSpan operator %(UnixTimeSpan a, Int32 b) => new UnixTimeSpan(a.Ticks % (UInt32)b);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using InnovEnergy.Lib.Time.Unix;
|
||||
using InnovEnergy.Lib.Units.Generator;
|
||||
|
||||
|
||||
|
@ -11,5 +12,6 @@ public readonly partial struct Energy
|
|||
|
||||
public Energy(Decimal value) => Value = value;
|
||||
|
||||
public static Power operator /(Energy energy, TimeSpan timeSpan) => energy.Value / (Decimal) timeSpan.TotalHours * 1000m;
|
||||
public static Power operator /(Energy energy, TimeSpan timeSpan) => energy.Value * 1000m / (Decimal) timeSpan.TotalHours ;
|
||||
public static Power operator /(Energy energy, UnixTimeSpan timeSpan) => energy.Value * 3_600_000m / timeSpan.Ticks;
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
using InnovEnergy.Lib.Time.Unix;
|
||||
using InnovEnergy.Lib.Units.Generator;
|
||||
|
||||
namespace InnovEnergy.Lib.Units;
|
||||
|
@ -17,4 +18,7 @@ public readonly partial struct Power
|
|||
|
||||
public static Energy operator *(Power power, TimeSpan timeSpan) => power.Value / 1000m * (Decimal) timeSpan.TotalHours;
|
||||
public static Energy operator *(TimeSpan timeSpan, Power power) => power.Value / 1000m * (Decimal) timeSpan.TotalHours;
|
||||
|
||||
public static Energy operator *(Power power, UnixTimeSpan timeSpan) => power.Value * timeSpan.Ticks / 3_600_000;
|
||||
public static Energy operator *(UnixTimeSpan timeSpan, Power power) => power.Value * timeSpan.Ticks / 3_600_000;
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Utils/Utils.csproj" />
|
||||
<ProjectReference Include="../Time/Time.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
|
|
Loading…
Reference in New Issue