-
Notifications
You must be signed in to change notification settings - Fork 638
/
Copy pathpatch-008.diff
21 lines (19 loc) · 1.72 KB
/
patch-008.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/python/src/std/chrono.cpp b/python/src/std/chrono.cpp
index 17eaa6e50..4c07e8ce6 100644
--- a/python/src/std/chrono.cpp
+++ b/python/src/std/chrono.cpp
@@ -7,6 +7,7 @@
#include <pybind11/pybind11.h>
#include <string>
#include <pybind11/stl.h>
+#include <mrpt/system/datetime.h>
#ifndef BINDER_PYBIND11_TYPE_CASTER
@@ -50,5 +51,8 @@ void bind_std_chrono(std::function< pybind11::module &(std::string const &namesp
cl.def_static("min", (mrpt::Clock::time_point (*)()) &std::chrono::time_point<mrpt::Clock, std::chrono::duration<int64_t, std::ratio<1, 10000000>>>::min, "C++: std::chrono::time_point<mrpt::Clock, std::chrono::duration<int64_t, std::ratio<1, 10000000>>>::min() --> mrpt::Clock::time_point");
cl.def_static("max", (mrpt::Clock::time_point (*)()) &std::chrono::time_point<mrpt::Clock, std::chrono::duration<int64_t, std::ratio<1, 10000000>>>::max, "C++: std::chrono::time_point<mrpt::Clock, std::chrono::duration<int64_t, std::ratio<1, 10000000>>>::max() --> mrpt::Clock::time_point");
cl.def("assign", (mrpt::Clock::time_point & (mrpt::Clock::time_point::*)(const mrpt::Clock::time_point &)) &std::chrono::time_point<mrpt::Clock, std::chrono::duration<int64_t, std::ratio<1, 10000000>>>::operator=, "C++: std::chrono::time_point<mrpt::Clock, std::chrono::duration<int64_t, std::ratio<1, 10000000>>>::operator=(const mrpt::Clock::time_point &) --> mrpt::Clock::time_point &", pybind11::return_value_policy::automatic, pybind11::arg(""));
+
+ cl.def("to_double", [](const mrpt::Clock::time_point &t) { return mrpt::Clock::toDouble(t); });
+ cl.def("__str__", [](const mrpt::Clock::time_point &t) { return mrpt::system::dateTimeLocalToString(t); }, "Gets the date and time of the given timestamp in local time.");
}
}