A function to be called at a particulat timestamp

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I want a function to be called at a particular timestamp. Can any tell me
please which class i should use.

Thanks,
Reshma
 
Reshma said:
Hello,

I want a function to be called at a particular timestamp. Can any tell me
please which class i should use.

Thanks,
Reshma

Create a thread, let the thread calculate how long it is to that
timestamp, let the thread sleep for that long, execute your method.

Things to look into:
System.Threading.Thread class
System.Threading.Thread.Sleep method
System.DateTime class
System.DateTime.Now method
System.TimeSpan class
System.TimeSpan.TotalMilliseconds method
 
Why wasting precious resources like threads for something that's provided in
the framework through the Timer delegates.

Willy.
 
Back
Top