We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 10706ca commit 52f410fCopy full SHA for 52f410f
src/Exceptionless.DateTimeExtensions/TimeSpanExtensions.cs
@@ -89,6 +89,12 @@ public static AgeSpan ToAgeSpan(this TimeSpan span)
89
return new AgeSpan(span);
90
}
91
92
+ /// <summary>
93
+ /// Subtracts the specified TimeSpan from this TimeSpan, ensuring the result never goes below TimeSpan.Zero.
94
+ /// </summary>
95
+ /// <param name="self">The TimeSpan to subtract from.</param>
96
+ /// <param name="other">The TimeSpan to subtract.</param>
97
+ /// <returns>The result of the subtraction, or TimeSpan.Zero if the result would be negative.</returns>
98
public static TimeSpan SubtractSaturating(this TimeSpan self, TimeSpan other)
99
{
100
return self >= other ? self.Subtract(other) : TimeSpan.Zero;
0 commit comments