Loops/timers in C

前端 未结 7 1563
忘了有多久
忘了有多久 2020-12-09 06:05

How does one create a timer in C?

I want a piece of code to continuously fetch data from a gps parsers output.

Are there good libraries for this or should it

相关标签:
7条回答
  • 2020-12-09 06:44

    The question about a timer is quite unspecific, though there are two functions that come to my mind that will help you:

    • sleep() This function will cause execution to stop for a specified number of seconds. You can also use usleep and nanosleep if you want to specify the sleeptime more exactly
    • gettimeofday() Using this function you are able to stop between to timesteps.

    See manpages for further explanation :)

    0 讨论(0)
提交回复
热议问题