linux sleeping with clock_nanosleep

前端 未结 4 1038
自闭症患者
自闭症患者 2021-02-09 13:10

I want to use clock_nanosleep for waiting of 1 microsec.. As far as I understand, I have to give an absolute time as input. Is the following code okay in this case?

<         


        
4条回答
  •  抹茶落季
    2021-02-09 13:39

    I recommend 2nd way of use sleep function. because , most of system function uses CLOCK_REALTIME, But, It has some serious problem, If system time and date has changed. In most case I recommend relative sleep way , best choice is using clock_monotonic.

提交回复
热议问题