File: patch-008.diff

package info (click to toggle)
mrpt 1%3A2.15.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 92,456 kB
  • sloc: cpp: 555,366; ansic: 36,840; xml: 3,872; python: 2,195; sh: 524; makefile: 232
file content (21 lines) | stat: -rw-r--r-- 1,762 bytes parent folder | download | duplicates (3)
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.");
 	}
 }