i want a real time clock with precision of microseconds how can i do so?
is there any real time clock other than stopwatch;
You want System.Diagnostics.Stopwatch, which can measure time intervals accurately to the microsecond (depending on hardware limitations).
System.Diagnostics.Stopwatch
uses the QueryPerformanceCounter
and QueryPerformanceFrequency
Windows APIs. The resolution is not standard across machines, but generally it's on the order of microseconds (see this KB article for more info).
In Vista/Win7 there is also QueryProcessCycleTime
and QueryThreadCycleTime
which will give you the number of elapsed cycles for your process/thread. This is useful if you want to know only the active time for the process (e.g. time when you weren't switched-out).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With