蟒蛇2.6:
import pytz
import time
import datetime
time.mktime(datetime.datetime(1990, 1, 1, tzinfo=pytz.utc).timetuple())
结果:
631148400.0
提升 1.46:
auto a = boost::posix_time::ptime(boost::gregorian::date(1990, 1, 1));
auto b = boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1)); // unix epoch
boost::posix_time::time_duration x = a - b;
std::cerr << x.total_seconds() << std::endl;
结果:
631152000
差异为 3600(1 小时)。为什么?