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