Skip to content

Commit

Permalink
dbus timeout parameter is in milliseconds.
Browse files Browse the repository at this point in the history
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

Signed-off-by: Fred Wright <[email protected]>
  • Loading branch information
rnorris authored and fhgwright committed Mar 4, 2017
1 parent dcb8bb0 commit facde92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libgps_dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit facde92

Please sign in to comment.