public static void Main(string[] args) { Loop.Default.Run(async() => { var t = new UVTimer(); var now = DateTime.Now; await t.StartAsync(TimeSpan.FromSeconds(1)); Console.WriteLine(DateTime.Now - now); }); }
public static void Main(string[] args) { Loop.Default.Run(async() => { var t = new UVTimer(); var stopwatch = Stopwatch.StartNew(); await t.StartAsync(TimeSpan.FromSeconds(1)); stopwatch.Stop(); Console.WriteLine(stopwatch.Elapsed); }); }
public static Task StartAsync(this UVTimer timer, TimeSpan timeout) { return(timer.StartAsync((ulong)timeout.TotalMilliseconds)); }