开发者

How do I set a timer 2 seconds in to the future with boost?

So I have a function which takes "const boost::posix_time::time_d开发者_Go百科uration& t" as an attribute and I can't find any information on how to do something as simple as set the duration 2 seconds (or whatever) in to the future. Lots of complex stuff explained in boost.org but I can't find any info on how to get the current time in some manageable form to which I can add a couple of seconds. This has to be something really simple but I can't figure it out...


time_duration doesn't hold a time as in "a specific point in time". It holds a length of time. If you want that length to be 2 seconds, you can do this:

t = boost::posix_time::seconds(2);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜