namespace Unosquare.RaspberryIO.Native { using System; using System.Diagnostics; /// /// 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 long ElapsedMicroseconds => (long)(ElapsedTicks * MicrosecondsPerTick); } }