How to stop time from running backwards on Linux?

后端 未结 5 1113
情书的邮戳
情书的邮戳 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:50

    gettimeofday() is not guaranteed to be monotonic. Use clock_gettime(CLOCK_MONOTONIC) if you need that guarantee.

提交回复
热议问题