Obtaining an accurate watch is difficult. The stopwatch has a very high resolution, but it is not accurate, deriving its frequency from the signal in the chipset. Which works with typical tolerances on electronic parts. The predominance of competition in the hardware business has surpassed expensive crystal oscillators with a guaranteed and stable frequency.
DateTime.UtcNow is not so accurate, but it gets help. Windows periodically contacts the time service, the default is time.windows.com to receive a high-quality clock update. And uses it to re-calibrate the machine clock, inserting small settings to make the clock catch up or slow down.
You need a lot of great tricks to get precision to the millisecond. You can get such a guarantee only for code that runs in kernel mode, works with interrupt priority, so it cannot be pre-held by other code and with its locked pages of code and data, so it cannot get into pages with page errors Commercial solutions use GPS radio to read the clock of GPS satellites, backed up by an oscillator that runs in the oven to provide thermal stability. Reading such a watch is a difficult problem, you have little use for a sub-millisecond source of synchronization, when the program you use can get preliminary utilization by the operating system, since it got the time and did not start again until ~ 45 ms later. Or worse.
DateTime.UtcNow accurate to 15.625 milliseconds and stable for very long periods thanks to service time updates. Going below, this does not make much sense, you cannot get the guarantee of fulfillment that you need in user mode in order to use it.
Hans passant
source share