boost获取系统时间(毫秒级)

在c++的chrono中没有找到相应的实现,只好从boost里面找了,代码如下:

#include<boost/date_time/posix_time/posix_time.hpp>

//
Get current time from the clock, using microseconds resolution const boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time(); // Get the time offset in current day const boost::posix_time::time_duration td = now.time_of_day(); frame.h = td.hours(); frame.m = td.minutes(); frame.s = td.seconds(); frame.ms = td.total_milliseconds() - ((frame.h * 3600 + frame.m * 60 + frame.s) * 1000);

 

posted @ 2014-02-22 09:11  Run.L  阅读(5736)  评论(0编辑  收藏  举报