Пример #1
0
        public void TicksToDaysAndTickOfDayAndBack(long ticks)
        {
            long tickOfDay;
            int  days = TickArithmetic.TicksToDaysAndTickOfDay(ticks, out tickOfDay);

            Assert.AreEqual(ticks, TickArithmetic.DaysAndTickOfDayToTicks(days, tickOfDay));
        }
Пример #2
0
        /// <summary>
        /// Returns a <see cref="Duration"/> that represents the given number of ticks.
        /// </summary>
        /// <param name="ticks">The number of ticks.</param>
        /// <returns>A <see cref="Duration"/> representing the given number of ticks.</returns>
        public static Duration FromTicks(long ticks)
        {
            long tickOfDay;
            int  days = TickArithmetic.TicksToDaysAndTickOfDay(ticks, out tickOfDay);

            return(new Duration(days, tickOfDay * NanosecondsPerTick));
        }