$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] Periodic Timer
From: Igor R (boost.lists_at_[hidden])
Date: 2008-09-09 17:10:44
> void print1()
> {
> if (count_ < 100)
> {
> timer1_.expires_at(timer1_.expires_at() +
> boost::posix_time::microseconds(10));
> timer1_.async_wait(boost::bind(&printer::print1, this));
> std::cout << "Timer 1: " << count_ << "\n";
> ++count_;
>
> }
>
> Over a period of time I think it will probably cause some slippage.
This is because you always take a new "reference time".
I guess that if you store the initial reference-point (when starting
the timer for the 1st time) and then always add to *it* a
time_duration*iterationNumber, then the slippage wouldn't accumulate.