Merge pull request #368 from arvidn/python-datetime

use datetime type for time_duration in python binding
This commit is contained in:
Arvid Norberg 2016-01-07 23:28:40 -05:00
commit 3efe85849e
1 changed files with 7 additions and 2 deletions

View File

@ -31,8 +31,13 @@ struct chrono_time_duration_to_python
{
static PyObject* convert(lt::time_duration const& d)
{
return incref(object(lt::duration_cast<lt::milliseconds>(d).count()
/ 1000.f).ptr());
object result = datetime_timedelta(
0 // days
, 0 // seconds
, lt::total_microseconds(d)
);
return incref(result.ptr());
}
};