system_clock fix

This commit is contained in:
arvidn 2017-02-10 14:47:37 -05:00 committed by Arvid Norberg
parent 4492cada4a
commit db32618c39
1 changed files with 8 additions and 2 deletions

View File

@ -56,14 +56,20 @@ struct time_duration_to_python
}
};
#if defined BOOST_ASIO_HAS_STD_CHRONO
using std::chrono::system_clock;
#else
using boost::chrono::system_clock;
#endif
struct time_point_to_python
{
static PyObject* convert(lt::time_point tpt)
{
object result;
if (tpt > lt::min_time()) {
time_t const tm = boost::chrono::system_clock::to_time_t(boost::chrono::system_clock::now()
+ boost::chrono::duration_cast<boost::chrono::system_clock::duration>(tpt - lt::clock_type::now()));
time_t const tm = system_clock::to_time_t(system_clock::now()
+ lt::duration_cast<system_clock::duration>(tpt - lt::clock_type::now()));
std::tm* date = std::localtime(&tm);
result = datetime_datetime(