C++ BOOST笔记 时间, 指针


时间

//当前时钟
std::chrono::duration_cast(
                        std::chrono::steady_clock::now().time_since_epoch()).count()
                        
//当前时间戳
std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()

//格式化
#include "boost/date_time/posix_time/posix_time_types.hpp"
boost::posix_time::ptime t(boost::posix_time::second_clock::local_time());
std::string date_str = to_iso_string(t); //   20020131T100001,123456789


指针

class RTPQueue;
typedef std::shared_ptr RTPQueuePtr;

RTPQueuePtr         rtp_queue_;
rtp_queue_ = std::make_shared(ssrc);

if(rtp_queue_.get()){
    ...
}
rtp_queue_.reset();

你可能感兴趣的:(c++)