Calculate execution time when sleep() is used

后端 未结 5 1752
难免孤独
难免孤独 2021-01-23 11:30

I am trying to read data from the ADC in the Beagle Bone, running Angstrom Linux distribution. I need to use a delay mechanism like sleep(), to only read samples at

5条回答
  •  醉话见心
    2021-01-23 12:16

    Indeed: during sleep(), the program doesn't run at all. And as clock() counts the CPU time and not the wall clock time, "no time passes".

    Use time() instead.

提交回复
热议问题