ej.
ej.

Reputation: 35

Question on C++ Timers

I am currently working on a project that will act like a Online selling website such as Amazon, or Ebay in a very small scale. I was wondering if anyone could point me in the right direction on how to use Timers for C++. Learning Socket Programming at the moment, and was trying to incorporate the timer for the auction time when someone is selling their product.

Thanks

Upvotes: 2

Views: 319

Answers (3)

user124493
user124493

Reputation:

C++ does not have built-in timers. What libraries you are willing to use really makes the difference in your answer.

Operating systems will have built-in timers, other libraries like Boost (mentioned in another answer), or toolkits like Qt or runtime systems like .NET will also have timers available.

I recommend you describe your environment in more detail before moving on.

What are you using for the Sockets? If it's a relatively well-known API, it will likely have a timer implementation as well. side note: You'll also want to look into threads to use for your sockets.

Upvotes: 3

navigator
navigator

Reputation: 1596

boost::asio timers, or the boost timer library (http://www.boost.org/doc/libs/1_40_0/libs/timer/index.html). Or just use the native OS timer functionalities, e.g., in Windows it'll be SetTimer and KillTime.

Upvotes: 1

John Zwinck
John Zwinck

Reputation: 249213

You mean like timer_create?

How are you handling your sockets? Threads or select? If the latter (or something like select), timer_create will be a natural fit.

Upvotes: 3

Related Questions