Python 2.6:
import pytz
import time
import datetime
time.mktime(datetime.datetime(1990, 1, 1, tzinfo=pytz.utc).timetuple())
Result:
631148400.0
Boost 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;
Result:
631152000
Difference is 3600 (1 hour). Why?
For the example below I set my time zone to GMT-01:
mktimetakes a time tuple based on local time, so the UTCdatetimeobject has to first be adjusted to local time.