system_clock fix
This commit is contained in:
parent
4492cada4a
commit
db32618c39
|
@ -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
|
struct time_point_to_python
|
||||||
{
|
{
|
||||||
static PyObject* convert(lt::time_point tpt)
|
static PyObject* convert(lt::time_point tpt)
|
||||||
{
|
{
|
||||||
object result;
|
object result;
|
||||||
if (tpt > lt::min_time()) {
|
if (tpt > lt::min_time()) {
|
||||||
time_t const tm = boost::chrono::system_clock::to_time_t(boost::chrono::system_clock::now()
|
time_t const tm = system_clock::to_time_t(system_clock::now()
|
||||||
+ boost::chrono::duration_cast<boost::chrono::system_clock::duration>(tpt - lt::clock_type::now()));
|
+ lt::duration_cast<system_clock::duration>(tpt - lt::clock_type::now()));
|
||||||
|
|
||||||
std::tm* date = std::localtime(&tm);
|
std::tm* date = std::localtime(&tm);
|
||||||
result = datetime_datetime(
|
result = datetime_datetime(
|
||||||
|
|
Loading…
Reference in New Issue