Check for nanosleep() availability

pull/17/head
dgiardini 2019-10-03 16:04:59 -03:00 zatwierdzone przez GitHub
rodzic c3d45e52ff
commit 5e25eabc34
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 6 dodań i 0 usunięć

6
main.c
Wyświetl plik

@ -216,7 +216,9 @@ int main(int argc, char **argv)
nmea_sentence_received() in aidecoder.c
*/
while(!do_exit && rtl_ais_isactive(ctx)) {
#if _POSIX_C_SOURCE >= 199309L // nanosleep available()
struct timespec five = { 0, 50 * 1000 * 1000};
#endif
const char *str;
if(config.use_internal_aisdecoder)
{
@ -226,7 +228,11 @@ int main(int argc, char **argv)
//puts(str); or code something that fits your needs
}
}
#if _POSIX_C_SOURCE >= 199309L // nanosleep available()
nanosleep(&five, NULL);
#else
usleep(50000);
#endif
}
rtl_ais_cleanup(ctx);
return 0;