diff options
author | Gary E. Miller <gem@rellim.com> | 2016-08-15 16:53:40 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2016-08-15 16:53:40 -0700 |
commit | e67e4118a0cbb5b5cecc62e7440299d0b5b35a37 (patch) | |
tree | 9aa35686f7b499ae7afd75e6b8b1f25a2aedfb32 /gpsmon.c | |
parent | 1721d7c431aeb471dcd3e36b09c4a432eb31dc5e (diff) | |
download | gpsd-e67e4118a0cbb5b5cecc62e7440299d0b5b35a37.tar.gz |
usleep() is removed from POSIX-2008. Replace with nanosleep()
I sure hope I did not drop a zero anywhere...
Diffstat (limited to 'gpsmon.c')
-rw-r--r-- | gpsmon.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -861,6 +861,7 @@ static bool do_command(const char *line) { #ifdef RECONFIGURE_ENABLE unsigned int v; + struct timespec delay; #endif /* RECONFIGURE_ENABLE */ #ifdef CONTROLSEND_ENABLE unsigned char buf[BUFLEN]; @@ -963,7 +964,12 @@ static bool do_command(const char *line) switcher->mode_switcher(&session, (int)v); context.readonly = true; (void)tcdrain(session.gpsdata.gps_fd); - (void)usleep(50000); + + /* wait 50,000 uSec */ + delay.tv_sec = 0; + delay.tv_nsec = 50000000L; + nanosleep(&delay, NULL); + /* * Session device change will be set to NMEA when * gpsmon resyncs. So stash the current type to @@ -1035,7 +1041,11 @@ static bool do_command(const char *line) * buffer. */ (void)tcdrain(session.gpsdata.gps_fd); - (void)usleep(50000); + /* wait 50,000 uSec */ + delay.tv_sec = 0; + delay.tv_nsec = 50000000L; + nanosleep(&delay, NULL); + (void)gpsd_set_speed(&session, speed, parity, stopbits); } else |