我试图把C++代码转换成Python。我可以用什么python等价物来代替std::chrono::steady_clock::now();
,它给出了linux上当前时间的精确计时,可以与其他时间点进行比较。在
void takeImages(steady_clock::time_point next_frame)
{
steady_clock::time_point current_time = steady_clock::now();
if (current_time >= next_frame) {
// do something if time right now is at or after next_frame
}
这相当于Python中的
遗憾的是C++在这里使用了不寻常的命名法。“单调”是其他标准和语言(C11、Posix、Python等)使用的术语。在time.monotonic()
。见time — Time access and conversions:相关问题 更多 >
编程相关推荐