You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 24, 2022. It is now read-only.
The `Stopwatch.ElapsedTicks` property is _timer_ ticks, which is not the same as the `DateTime.Ticks` according to the note in the remarks section of [the documentation](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.stopwatch.elapsedticks?view=netcore-3.1#remarks) (and my testing that led to this discovery).
Try the following simple c# sample to see the difference:
```
var serverTimeAtStart = DateTime.UtcNow;
var startedAt = Stopwatch.StartNew();
Thread.Sleep(5000);
var CurrentServerTime = new DateTime(serverTimeAtStart.Ticks + startedAt.ElapsedTicks, DateTimeKind.Utc);
var CorrectServerTime = new DateTime(serverTimeAtStart.Ticks + startedAt.Elapsed.Ticks, DateTimeKind.Utc);
Debug.WriteLine($"Current: {CurrentServerTime}\r\nCorrect: {CorrectServerTime}\r\nNow: {DateTime.UtcNow}");
```
0 commit comments