Example #1
0
            /// <summary>
            /// Creates a <see cref="Uniform.TimeSpan" /> with an exclusive lower bound. Should not
            /// be used directly; instead, use <see cref="Uniform.NewInclusive(System.TimeSpan, System.TimeSpan)" />.
            /// </summary>
            /// <exception cref="ArgumentOutOfRangeException">
            /// Thrown when <paramref name="low"/> is greater than <paramref name="high"/>.
            /// </exception>
            public static Uniform.TimeSpan CreateInclusive(System.TimeSpan low, System.TimeSpan high)
            {
                if (low > high)
                {
                    throw new ArgumentOutOfRangeException(nameof(high), $"{nameof(high)} ({high}) must be higher than or equal to {nameof(low)} ({low}).");
                }

                Uniform.Int64 backing = Uniform.Int64.CreateInclusive(low.Ticks, high.Ticks);
                return(new Uniform.TimeSpan(backing));
            }
Example #2
0
 private TimeSpan(Uniform.Int64 backing) => _backing = backing;