problem using Timer with 2 Threading proccesses

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

Hello,

I am trying to measure the elapsed time between 2
processes. If I declare startTime As Double, endTime as
Double and say

startTime = Timer
....
process1
....
process2
....
endTime = Timer

this works fine. But if I use Imports System.Threading,
the program won't compile with ...=Timer. I want to
measure the elapsed time when I run the 2 processes on
different threads. Could someone explain the correct
syntax or way to accomplish this? I have tried

startTime = System.Timers.Timer

but not working. Should I use a dateTime var and then do
like a dateDiff thing?

TIA,
Rich
 
dim start as long = DateTime.Now
'do something
dim end as long = DateTime.Now

dim t as TimeSpan = new TimeSpan(end - start)
't holds your info
 
sorry DateTime.Now.Ticks
Greg Young said:
dim start as long = DateTime.Now
'do something
dim end as long = DateTime.Now

dim t as TimeSpan = new TimeSpan(end - start)
't holds your info
 
Thanks all. I have been working with .Net for only a few
months right now, so I have lots to learn. I will use the
TimeSpan thing as suggested.

Thanks for all the help.
Rich
 
Back
Top