Add Timespan helpers (#4342)

This commit is contained in:
Wrexbe (Josh)
2023-08-31 11:51:06 -07:00
committed by GitHub
parent a289659b49
commit 650929dcbb

View File

@@ -338,6 +338,16 @@ namespace Robust.Shared.Maths
return MathF.Max(MathF.Min(a, b), MathF.Min(MathF.Max(a, b), c));
}
public static TimeSpan Min(TimeSpan a, TimeSpan b)
{
return a < b ? a : b;
}
public static TimeSpan Max(TimeSpan a, TimeSpan b)
{
return a > b ? a : b;
}
#endregion MinMax
#region Mod
@@ -592,6 +602,11 @@ namespace Robust.Shared.Maths
return a + (b - a) * blend;
}
public static TimeSpan Lerp(TimeSpan a, TimeSpan b, double t)
{
return a + t * (b - a);
}
#endregion Lerp
#region InterpolateCubic