RoundTicks() public static method

public static RoundTicks ( long ticks ) : long
ticks long
return long
コード例 #1
0
 /// <summary>
 /// Sets the Position to the specified value.
 /// If the timer is running, it will be paused after this method call.
 /// </summary>
 /// <param name="ts">The ts.</param>
 public void Seek(TimeSpan ts)
 {
     lock (SyncLock)
     {
         Stopwatch.Reset();
         OffsetTicks = Helper.RoundTicks(ts.Ticks < 0 ? 0 : ts.Ticks);
         IsPlaying   = false;
     }
 }
コード例 #2
0
        private long ComputePositionTicks(decimal speedRatio)
        {
            var offsetTicks = Convert.ToDecimal(Stopwatch.Elapsed.Ticks) * speedRatio + Convert.ToDecimal(OffsetTicks);

            return(Helper.RoundTicks(Convert.ToInt64(offsetTicks)));
        }