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);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM