The third Boost asio tutorial has a line that shows how to update the timer and still prevent drift. The line is as follows:
t->expires_at(t->expires_at() + boost::posix_time::seconds(1));
Maybe this is for me, but I could not find the documentation for the second use of e xpires_at()without parameters. expires_at(x)sets a new expiration, canceling any pending handlers. So, presumably expires_at () does what, return time of the last expiration? So, adding one second, if there should be a certain amount of ms, say n ms, then it will, in fact, be βsubtractedβ from the next expiration from the moment the time is taken into account? What happens if the time taken to execute this handler is more than 1 second in this example? Does it work immediately?
source
share