在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);
原文:http://www.cnblogs.com/run220/p/3560401.html