18 using time_point_h = std::chrono::time_point<std::chrono::system_clock, std::chrono::hours>;
19 using time_point_m = std::chrono::time_point<std::chrono::system_clock, std::chrono::minutes>;
20 using time_point_s = std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>;
22 = std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds>;
24 = std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>;
33 using system_time = std::chrono::system_clock::time_point;
34 using steady_time = std::chrono::steady_clock::time_point;
36 using timespan = std::chrono::duration<int64_t, std::nano>;
37 using timestamp = std::chrono::time_point<std::chrono::system_clock, timespan>;
41 m.def(
"test_chrono1", []() {
return std::chrono::system_clock::now(); });
45 m.def(
"test_chrono2", [](system_time
t) {
return t; });
49 m.def(
"test_chrono3", [](std::chrono::system_clock::duration
d) {
return d; });
53 m.def(
"test_chrono4", [](system_time
a, system_time
b) {
return a -
b; });
57 m.def(
"test_chrono5", []() {
return std::chrono::steady_clock::now(); });
61 m.def(
"test_chrono6", [](steady_time t) {
return t; });
65 m.def(
"test_chrono7", [](std::chrono::microseconds t) {
return t; });
67 m.def(
"test_chrono_float_diff",
68 [](std::chrono::duration<float> a, std::chrono::duration<float> b) {
return a -
b; });
70 m.def(
"test_nano_timepoint",
71 [](timestamp start, timespan
delta) -> timestamp {
return start +
delta; });
74 py::class_<different_resolutions>(
m,
"different_resolutions")
std::chrono::time_point< std::chrono::system_clock, std::chrono::minutes > time_point_m
time_point_us timestamp_us
std::chrono::time_point< std::chrono::system_clock, std::chrono::hours > time_point_h
TEST_SUBMODULE(chrono, m)
std::chrono::time_point< std::chrono::system_clock, std::chrono::microseconds > time_point_us
std::chrono::time_point< std::chrono::system_clock, std::chrono::milliseconds > time_point_ms
std::chrono::time_point< std::chrono::system_clock, std::chrono::seconds > time_point_s
time_point_ms timestamp_ms