Difference between steady_clock vs system_clock?

前端 未结 5 1025
情深已故
情深已故 2020-12-07 16:40

I am trying to see whether my data is 120 second old or not by looking at the timestamp of the data so I have below code:

uint64_t now = duration_cast

        
5条回答
  •  遥遥无期
    2020-12-07 17:42

    1. steady_clock uses the system startup time as its epoch, system_clock uses 1970-1-1 00:00 as its epoch, so there is no way to do any math between them, this makes no sense.

    2. Before doing any subtraction between 2 unsigned integers, please make sure the minuend is larger than the subtrahend.

提交回复
热议问题