looking for sort of timer object

Hello,

i have quite a general question: I am looking for a "timer object" to use in a C++ application. Is there an OpenSource Version available ?
That would be my preferred solution.
And which one is "good" ?

I have no experience with such things so far.
Actually all i want to achieve is a certain task to be performed everx x seconds, so the easiest way for me would be an object that calls a method every x seconds and i wonder if such a thing exists or if i have to make that on my own.


Thanks for reading this and for any answer in advance,

....
Last edited on
In what kind of environment?
Console? Windows? Linux?

A timer object is the easy part. How you want to interact with the rest of the program is the hard part and very much depends on the environment.
If you want the timer to run asynchronously from the rest of the program, then you are probably going to need to use threads.

C++11 added some time functions to the standard library. Check the <chrono> header in the reference section.

Aceix.
> Actually all i want to achieve is a certain task to be performed everx x seconds,

http://www.cplusplus.com/forum/general/125680/#msg681332
Hello,
... i was out on a weekend and didn't read that 'til now
well, as i said, a very general question ... however, i think i should use threads. It will not do without and might look simillar to the example by JLBorges. I will try with that and see how far i get.
Thanks a lot for your help,

...
Topic archived. No new replies allowed.