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

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

你可能感兴趣的:(boost 获取当前时间戳(秒or毫秒))