How to stop time from running backwards on Linux?

后端 未结 5 1190
情书的邮戳
情书的邮戳 2021-02-12 11:15

Here\'s a little test I\'ve written to verify that time does indeed only run forwards in Linux.

#include 
#include   

bool timeG         


        
5条回答
  •  我在风中等你
    2021-02-12 11:49

    There is an open issue at the VirtualBox Bug Tracker. They link to a blog post stating why you shouldn't use gettimeofday() to measure the passage of time:

    The most portable way to measure time correctly seems to be clock_gettime(CLOCK_MONOTONIC, ...)

提交回复
热议问题