#include <time.h>
#include <iostream>
#include <boost/date_time.hpp>
using namespace std;
using namespace boost::posix_time;
using namespace boost::gregorian;
using namespace std;
void time_test1()
{
int seconds = time((time_t*)NULL);
cout<<" seconds=="<<seconds<<endl;
}
int64_t time_test2()
{
boost::posix_time::ptime epoch = time_from_string("1970-1-1 00:00:00");
//*标准 格林尼治 时间 *//
boost::posix_time::time_duration time_from_epoch = boost::posix_time::second_clock::universal_time() - epoch;
//*当地时间*//
// boost::posix_time::time_duration time_from_epoch = boost::posix_time::second_clock::local_time() - epoch;
cout<<"time_from_epoch.total_seconds()=="<<time_from_epoch.total_seconds()<<endl;
return time_from_epoch.total_seconds();
}
int main(){
time_test1();
time_test2();
return 0;
}