using System; using System.Diagnostics; namespace Unosquare.RaspberryIO.Native { /// /// Provides access to a high- esolution, time measuring device. /// /// public class HighResolutionTimer : Stopwatch { /// /// Initializes a new instance of the class. /// /// High-resolution timer not available public HighResolutionTimer() { if(!IsHighResolution) { throw new NotSupportedException("High-resolution timer not available"); } } /// /// Gets the numer of microseconds per timer tick. /// public static Double MicrosecondsPerTick { get; } = 1000000d / Frequency; /// /// Gets the elapsed microseconds. /// public Int64 ElapsedMicroseconds => (Int64)(this.ElapsedTicks * MicrosecondsPerTick); } }