Am Monday 07 September 2009 13:24:58 schrieb Bjarne Laursen:
I have used a deadline_timer to generate a polling every 1 second. Unfortunely when I use the linux date command the timing is curupted. (If I set the clock back 1 min. I will be missing 60 pollings). What can I do about that? -Bjarne
I don't know how to solve that within asio but I also needed a timer like that and didn't want to create a dependency on asio just for that, so I'm using the following for now, which should also solve your problem (if you don't also use asio for other purposes): class cache_timer{ public: cache_timer(...) : resolution(...) , thread(boost::bind(&cache_timer::run,this)) {} //throw(thread_resource_error) void run(){ while(!this_thread::interruption_requested()){ this_thread::sleep(resolution); ... } } ~cache_timer(){ //throw() this->thread.interrupt(); this->thread.join(); } private: posix_time::time_duration resolution; boost::thread thread; };