From ed09a6a01d164adc249702ac8965313d706cc1bb Mon Sep 17 00:00:00 2001 From: arvidn Date: Thu, 7 Jan 2016 17:47:53 -0500 Subject: [PATCH] use datetime type for time_duration in python binding --- bindings/python/src/datetime.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bindings/python/src/datetime.cpp b/bindings/python/src/datetime.cpp index 7423de9aa..220607bfe 100644 --- a/bindings/python/src/datetime.cpp +++ b/bindings/python/src/datetime.cpp @@ -31,8 +31,13 @@ struct chrono_time_duration_to_python { static PyObject* convert(lt::time_duration const& d) { - return incref(object(lt::duration_cast(d).count() - / 1000.f).ptr()); + object result = datetime_timedelta( + 0 // days + , 0 // seconds + , lt::total_microseconds(d) + ); + + return incref(result.ptr()); } };