General information
Category:
Coding, syntax and commands
>Is using Ticks the way to go to calculate the number of seconds with two decimals to obtain a processing time of an operation which normally executes within 0 to 2 seconds? I would like to obtain something like 0.32, 1.34, etc. Is the use of Date.Now.Ticks the approach to use?
Michel,
DateTimes have a 1-tick granularity, so they are good for timing stuff. The only thing that could negatively affect a simple DateTime based timer is that its thread may get interrupted between the last statement inside the timing block and the call to DateTime.Now.
If you really want a hardcore timer, you'd have to enclose the entire batch in a synclock.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only