PyPhoenixClockBackend
1.2.1
Binding for PhoenixClock library
Toggle main menu visibility
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 : LGPL-3.0-only
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
16
namespace
nb = nanobind;
17
18
inline
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
make_clock_backend_binding
void make_clock_backend_binding(nb::module_ &m)
Definition
clock_backend_binding.h:18
src
clock_backend_binding.h
Generated by
1.17.0