i need help, im new to programming

i need timer functions to do stuff like:

1
2
3
4
timer()
{
     myFunctions
}


i want the timer to repeat it self every 2 hours,
OR
i want a thing to happen every 2 hours,

sorry for my poor english, and thank you all
Are you using c++11? 'cause if you do just look round #include <chrono> , else just use the sleep function with a damn huge number.. (not sure if its the safe way --')
thanks bro Paul Combaldieu .. im trying to learn more about chrno lib ..
std::chrono can be tough to get used to. I've only used it for performance monitoring myself but, I suppose you might be able to hack together some stuff with duration objects to suit your purposes... but 2 hours is a very long time. I'm curious as to the application.

Here's this site's chrono reference:
http://lmgtfy.com/?q=chrono+c%2B%2B

And here's a tutorial of duration objects:
http://www.boost.org/doc/libs/1_47_0/doc/html/chrono/users_guide.html#chrono.users_guide.tutorial

a little dated, as paul combaldieu mentioned with C++11 chrono is now in the stl.

Sleep does something funky with threads and may not work if you are multi-threaded... As this other post mentions:
http://www.cplusplus.com/forum/windows/69163/

Last edited on
thanks all, I appreciate your raplay
Topic archived. No new replies allowed.