/// <summary> /// Returns a <see cref="TimeSpan"/> value that is rounded either towards negative infinity or positive infinity. /// </summary> /// <param name="value">A <see cref="TimeSpan"/> value to be rounded.</param> /// <param name="interval">The <see cref="double"/> value that in combination with <paramref name="timeUnit"/> specifies the rounding of <paramref name="value"/>.</param> /// <param name="timeUnit">One of the enumeration values that specifies the time unit of <paramref name="interval"/>.</param> /// <param name="direction">One of the enumeration values that specifies the direction of the rounding.</param> /// <returns>A <see cref="TimeSpan"/> value that is rounded either towards negative infinity or positive infinity.</returns> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="direction"/> is an invalid enumeration value. /// </exception> public static TimeSpan Round(this TimeSpan value, double interval, TimeUnit timeUnit, VerticalDirection direction) { return(Round(value, TimeSpanConverter.FromDouble(interval, timeUnit), direction)); }
/// <summary> /// Converts the specified <paramref name="value"/> to its equivalent <see cref="TimeSpan"/> representation. /// </summary> /// <param name="value">The value to be converted.</param> /// <param name="timeUnit">One of the enumeration values that specifies the outcome of the conversion.</param> /// <returns>A <see cref="TimeSpan"/> that corresponds to <paramref name="value"/> from <paramref name="timeUnit"/>.</returns> /// <exception cref="System.OverflowException"> /// The <paramref name="value"/> paired with <paramref name="timeUnit"/> is outside its valid range. /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="timeUnit"/> was outside its valid range. /// </exception> public static TimeSpan ToTimeSpan(this double value, TimeUnit timeUnit) { return(TimeSpanConverter.FromDouble(value, timeUnit)); }