zipkin4net icon indicating copy to clipboard operation
zipkin4net copied to clipboard

Please use System.Diagnostics.Stopwatch.GetTimestamp() for high resolution time

Open AceHack opened this issue 7 years ago • 1 comments

In some static constructor keep up with the following:

            StartDateTime = DateTime.UtcNow;
            StartTicks = System.Diagnostics.Stopwatch.GetTimestamp();

Then you can calculate the current high precision time using:

            startDateTime.AddTicks(System.Diagnostics.Stopwatch.GetTimestamp() - startTicks)

Thanks.

AceHack avatar Jan 03 '19 20:01 AceHack

Then you can check the following to make sure it's high precision time:

            Console.WriteLine(System.Diagnostics.Stopwatch.IsHighResolution);
            Console.WriteLine(System.Diagnostics.Stopwatch.Frequency);

AceHack avatar Jan 03 '19 20:01 AceHack