boost 获取当前时间戳(秒or毫秒)

来源:互联网 发布:毒品网络 下载 编辑:程序博客网 时间:2024/05/07 07:58
int64_t GetCurrentStamp64()
{
  boost::posix_time::ptime epoch(boost::gregorian::date(1970, boost::gregorian::Jan, 1));
  boost::posix_time::time_duration time_from_epoch =
  //  boost::posix_time::microsec_clock::universal_time() - epoch;

    boost::posix_time::second_clock::universal_time() - epoch;

  //return time_from_epoch.total_microseconds();

  return time_from_epoch.total_seconds();
}
0 0
原创粉丝点击