Commit a6f30bee authored by Zeeshan Ali's avatar Zeeshan Ali

location: Correctly handle same timestamp case

Same timestamp on new and previous locations, is not programmer error
and hence use of g_return_if_fail() for this case would be wrong.
Instead simply set the speed to unknown in such cases.
parent 1975495f
......@@ -493,7 +493,11 @@ gclue_location_set_speed_from_prev_location (GClueLocation *location,
timestamp = geocode_location_get_timestamp (gloc);
prev_timestamp = geocode_location_get_timestamp (prev_gloc);
g_return_if_fail (timestamp != prev_timestamp);
if (timestamp == prev_timestamp) {
speed = GCLUE_LOCATION_SPEED_UNKNOWN;
goto out;
}
speed = geocode_location_get_distance_from (gloc, prev_gloc) *
1000.0 / (timestamp - prev_timestamp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment