PyPhoenixClockBackend  1.1.0
Binding for PhoenixClock library
Loading...
Searching...
No Matches
clock_backend_binding.h
Go to the documentation of this file.
1/***************************************
2 Auteur : Thibaut Oprinsen
3 Mail : thibaut.oprinsen@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7#ifndef CLOCKBACKEND_BINDING_H
8#define CLOCKBACKEND_BINDING_H
9
10#include "PClockBackend.h"
11#include <time.h>
12#include <nanobind/nanobind.h>
13#include <nanobind/stl/string.h>
14#include <nanobind/stl/chrono.h>
15
16namespace nb = nanobind;
17
18inline void make_clock_backend_binding(nb::module_ &m) {
19 nb::module_ m_clock_backend = m.def_submodule("clock_backend", "Clock backend utilities");
20
21 nb::class_<PClockBackend>(m_clock_backend, "PClockBackend")
22
23 // Constructor
24 .def(nb::init<>())
25
26 // Static methods only since PClockBackend is a struct with static methods
27 .def_static("now", &PClockBackend::now,
28 "Get current time with PClockBackend")
29
30 .def_static("sleep", [](time_t ellapsedTime) {
31 PClockBackend::sleep(ellapsedTime);
32 },
33 nb::arg("ellapsedTime"),
34 "Sleep for the given elapsed time"
35 );
36}
37
38
39#endif // CLOCKBACKEND_BINDING_H
void make_clock_backend_binding(nb::module_ &m)