On Mon, 21 Nov 2005 18:25:17 -0000, Ben wrote:
Hi
I have to run a process in an VB ASP .net.
I have to measure how long the process has taken in seconds/miliseconds.
Seeing as the Date datatype does not handle miliseconds it seems TimeSpan is
the correct datatype to use.
The date datatype certainly does include milliseconds. But you are
correct, TimeSpan is the correct date type to use to measure an elapsed
span of time.
The rest of your post is asking the wrong questions.
Here is how to measure how long something takes:
dim StartTime as DateTime = Now()
' do whatever it is that we're timing
dim FinishTime as DateTime = Now()
dim ElapsedTime as TimeSpan = FinishTime.Subtract(StartTime)
Msgbox("Total time taken: " & ElapsedTime.ToString("ss.ff")