When I start some process, I take DateTime.Now and remember it as StartTime.
Later in process, I substract StartTime from DateTime.Now to calculate the time passed between these two – between start and current time.
Now, the problem is that this approach is not always accurate – during process, time might be changed by windows using time servers or even manually by user.
Are there some other approaches to measure time as described that will always work properly – even if the windows time is changed in meanwhile?
Use a Stopwatch.
The Stopwatch is like a watch itself, so it doesn’t count on the computer’s clock.
Just start one at the beginning, and check Elapsed to see how much time has passed.