|
13 | 13 | */ |
14 | 14 |
|
15 | 15 | // pybind11 |
| 16 | +#include <pybind11/chrono.h> |
| 17 | +#include <pybind11/functional.h> |
16 | 18 | #include <pybind11/pybind11.h> |
| 19 | +#include <pybind11/stl.h> |
17 | 20 |
|
18 | 21 | // MRPT headers |
19 | 22 | #include <mrpt/core/Clock.h> |
|
28 | 31 | #include <mrpt/core/reverse_bytes.h> |
29 | 32 |
|
30 | 33 | #include <cstdint> |
31 | | -#include <future> |
32 | 34 | #include <string> |
33 | | -#include <thread> |
34 | 35 |
|
35 | 36 | namespace py = pybind11; |
36 | 37 |
|
@@ -86,10 +87,16 @@ PYBIND11_MODULE(mrpt_core_py, m) |
86 | 87 | // ------------------ Clock ------------------ |
87 | 88 | py::class_<mrpt::Clock>(m, "Clock") |
88 | 89 | .def_static( |
89 | | - "now", []() { return mrpt::Clock::nowDouble(); }, "Current time in seconds (double)") |
| 90 | + "nowDouble", []() { return mrpt::Clock::nowDouble(); }, |
| 91 | + "Current time in seconds (double)") |
90 | 92 | .def_static( |
91 | | - "now_time_point", []() { return mrpt::Clock::now(); }, |
92 | | - "Current time as std::chrono::time_point"); |
| 93 | + "now", []() { return mrpt::Clock::now(); }, "Current time as mrpt::Clock::time_point") |
| 94 | + .def_static( |
| 95 | + "toDouble", [](const mrpt::Clock::time_point& tp) { return mrpt::Clock::toDouble(tp); }, |
| 96 | + py::arg("time_point"), "Convert mrpt::Clock::time_point to double seconds") |
| 97 | + .def_static( |
| 98 | + "fromDouble", [](double t) { return mrpt::Clock::fromDouble(t); }, py::arg("seconds"), |
| 99 | + "Convert double seconds to mrpt::Clock::time_point"); |
93 | 100 |
|
94 | 101 | // ------------------ WorkerThreadsPool ------------------ |
95 | 102 | py::class_<mrpt::WorkerThreadsPool>(m, "WorkerThreadsPool") |
|
0 commit comments