PyPhoenixClockBackend  1.0.1
Binding for PhoenixClock library
Loading...
Searching...
No Matches
ClockBackend_binding.cpp File Reference
#include "PClockBackend.h"
#include <time.h>
#include <nanobind/nanobind.h>
#include <nanobind/stl/string.h>
#include <nanobind/stl/chrono.h>
+ Include dependency graph for ClockBackend_binding.cpp:

Go to the source code of this file.

Functions

 NB_MODULE (clockSecond, m)
 

Function Documentation

◆ NB_MODULE()

NB_MODULE ( clockSecond ,
m  )

Definition at line 15 of file ClockBackend_binding.cpp.

15 {
16 m.doc() = "Nanobind bindings for clock backend class";
17 nb::class_<PClockBackend>(m, "PClockBackend")
18
19 // Constructor
20 .def(nb::init<>())
21
22 // Static methods only since PClockBackend is a struct with static methods
23 .def_static("now", &PClockBackend::now,
24 "Get current time with PClockBackend")
25
26 .def_static("sleep", [](time_t ellapsedTime) {
27 PClockBackend::sleep(ellapsedTime);
28 },
29 nb::arg("ellapsedTime"),
30 "Sleep for the given elapsed time");
31}