diff --git a/src/mod_utility.cpp b/src/mod_utility.cpp index 8d1a504..777e80a 100644 --- a/src/mod_utility.cpp +++ b/src/mod_utility.cpp @@ -2,6 +2,7 @@ #include "utility/shortestPaths.h" #include "utility/smtsolver.h" +#include "utility/chrono.h" PYBIND11_MODULE(utility, m) { @@ -9,4 +10,5 @@ PYBIND11_MODULE(utility, m) { define_ksp(m); define_smt(m); + define_chrono(m); } diff --git a/src/utility/chrono.cpp b/src/utility/chrono.cpp new file mode 100644 index 0000000..def183e --- /dev/null +++ b/src/utility/chrono.cpp @@ -0,0 +1,8 @@ +#include "chrono.h" +#include "src/helpers.h" + +void define_chrono(py::module& m) { + py::class_(m, "milliseconds") + .def("count", &std::chrono::milliseconds::count) + .def("__str__", [](std::chrono::milliseconds const& t) { std::stringstream strstr; strstr << t.count(); return strstr.str(); }); +} \ No newline at end of file diff --git a/src/utility/chrono.h b/src/utility/chrono.h new file mode 100644 index 0000000..42762f5 --- /dev/null +++ b/src/utility/chrono.h @@ -0,0 +1,5 @@ +#pragma once + +#include "src/common.h" + +void define_chrono(py::module& m); \ No newline at end of file