Boost logo

Boost :

From: JH (jupiter.hce_at_[hidden])
Date: 2019-08-26 07:17:22

Thanks Gavin,

My problem is I have wired behavior for expiry at absolute time, I
have used deadline_timer for relative time for long time which works
well, but I could not get the absolute time work, here is what I set
up the timer to expire at 1minute 0 seconds:

boost::posix_time::ptime posixTime(clockNow,
boost::posix_time::hours(utcTime.time_of_day().hours()) +
boost::posix_time::minutes(utcTime.time_of_day().minutes() + 1));


async_wait(boost::bind(&ClockTimer::Handler, this,

So the expiry time is 2019-Aug-26 07:09:00, but when the timer
expired, it called callback function 8 times consecutively, what could
I be wrong here?

Thank you.

- jupiter

On 8/26/19, Gavin Lambert via Boost <boost_at_[hidden]> wrote:
> On 26/08/2019 15:49, JH wrote:
>> How can I set deadline_timer expired at real clock absolute time at 0
>> minute, then repeat every minute? So it should expired at: 13:40:00,
>> 13:41:00, 13:42:00 and so on?
> Call timer.expires_at(when), where "when" is the ptime that you have
> calculated as the "next minute" time.
> Bear in mind that there may be some events (eg. PC sleep, processing
> overshoot) where you may need to skip some minutes, so you should
> generally calculate this time relative to when you actually finished the
> previous processing cycle (if this is a cyclic timer).
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at