diff --git a/src/EcsRx/Scheduling/ElapsedTime.cs b/src/EcsRx/Scheduling/ElapsedTime.cs index 52b9246d..7c1f5f7c 100644 --- a/src/EcsRx/Scheduling/ElapsedTime.cs +++ b/src/EcsRx/Scheduling/ElapsedTime.cs @@ -2,7 +2,7 @@ namespace EcsRx.Scheduling { - public struct ElapsedTime + public struct ElapsedTime : IEquatable { public TimeSpan DeltaTime; public TimeSpan TotalTime; @@ -12,5 +12,24 @@ public ElapsedTime(TimeSpan deltaTime, TimeSpan totalTime) DeltaTime = deltaTime; TotalTime = totalTime; } + + public bool Equals(ElapsedTime other) + { + return DeltaTime.Equals(other.DeltaTime) && TotalTime.Equals(other.TotalTime); + } + + public override bool Equals(object obj) + { + return obj is ElapsedTime other && Equals(other); + } + + public override int GetHashCode() + { + unchecked + { + return (DeltaTime.GetHashCode() * 397) ^ TotalTime.GetHashCode(); + } + } + } } \ No newline at end of file