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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top