From 837527d487c7e232b36dd87c95a15b7852f2e057 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 16 Dec 2020 17:17:35 -0500 Subject: refactor to two-digit day names and add puzzlename --- lib/Extensions.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/Extensions.cs') diff --git a/lib/Extensions.cs b/lib/Extensions.cs index a1ffbcc..eb8c3cb 100644 --- a/lib/Extensions.cs +++ b/lib/Extensions.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics; using System.Linq; namespace aoc2019.lib @@ -28,5 +29,20 @@ namespace aoc2019.lib foreach (var item in sequence) yield return item; } + + /// + /// increased accuracy for stopwatch based on frequency. + /// + /// blog + /// details here + /// + /// + /// + /// + public static double ScaleMilliseconds(this Stopwatch stopwatch) + { + return 1_000 * stopwatch.ElapsedTicks / (double) Stopwatch.Frequency; + } } } \ No newline at end of file -- cgit 1.4.1