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
Simplest method available:
#include void *do_smth_periodically(void *data) { int interval = *(int *)data; for (;;) { do_smth(); usleep(interval); } } int main() { pthread_t thread; int interval = 5000; pthread_create(&thread, NULL, do_smth_periodically, &interval) ... }