I have code that measure how much time some operation took. If day light saving takes effect in the middle of the operation, I get inaccurate data.
So for example, I am doing
DateTime startAt = DateTime.Now;
DoOperation(); //day light saving takes effect in the middle
int seconds = (DateTime.Now - startAt).TotalSeconds;
//second has wrong seconds
Is there a way to measure this?
Thanks
Use the
StopWatchclass instead…eg