20 nb::module_ m_clock_ns = m.def_submodule(
"clock_ns",
"Clock utilities with nanosecond precision");
22 nb::class_<PClockNs>(m_clock_ns,
"PClockNs")
27 .def_prop_rw(
"offsetTimeNs",
28 [](PClockNs &c) {
return c.getOffsetTimeNs(); },
29 [](PClockNs &c, time_t value) { c.setOffsetTimeNs(value); })
32 .def(
"getFullTimeNs", &PClockNs::getFullTimeNs,
33 "Get the full time in nanoseconds")
35 .def(
"getDateNs", &PClockNs::getDateNs,
36 "Get the date at nanosecond precision")
38 .def(
"getDateCompactNs", &PClockNs::getDateCompactNs,
39 "Get the date at nanosecond precision in compact format")
41 .def(
"now", &PClockNs::now,
42 "Get the full time in nanoseconds (alias for getFullTimeNs)")
44 .def(
"sleep", [](
const PClockNs &c, time_t ellapsedTime) {
45 c.sleep(ellapsedTime);
47 "Sleep for the given elapsed time in nanoseconds"