gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH 3/4] dbus timeout parameter is in milliseconds.


From: Robert Norris
Subject: [gpsd-dev] [PATCH 3/4] dbus timeout parameter is in milliseconds.
Date: Sat, 4 Mar 2017 18:59:27 +0000

The value passed into gps_mainloop() and thuis gps_dbus_mainloop()
is in microseconds.

Thus to convert from microseconds to milliseconds, one needs to divide by
1000 (not multiply!).

This also prevents the timeout value overflowing, when a large value
timeout is passed in.

NB This timeout value appears not to be actually used by current versions
of dbus, see this bug: https://bugs.freedesktop.org/show_bug.cgi?id=100062
---
 libgps_dbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgps_dbus.c b/libgps_dbus.c
index 29cd0dd0..c5cffbf1 100644
--- a/libgps_dbus.c
+++ b/libgps_dbus.c
@@ -134,7 +134,7 @@ int gps_dbus_mainloop(struct gps_data_t *gpsdata,
     share_gpsdata = gpsdata;
     PRIVATE(share_gpsdata)->handler = (void (*)(struct gps_data_t *))hook;
     for (;;)
-       if (dbus_connection_read_write_dispatch(connection, timeout * 1000) != 
TRUE)
+       if (dbus_connection_read_write_dispatch(connection, 
(int)(timeout/1000)) != TRUE)
            return -1;
     return 0;
 }
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]