How to calculate total distance by datetime
I have tried by filtering your view by dates and IMHO it works fine:

select   select   prev_, curr_, p_time_, c_time_, distance_km
from     distances
where    p_time_ &gt;= '2017-06-23 12:00:00' 
and      c_time_ &lt;= '2017-06-23 14:00:00'
order by prev_
;

| prev_ | curr_ | p_time_             | c_time_             | distance_km |
|-------|-------|---------------------|---------------------|-------------|
| 1     | 2     | 23.06.2017 12:21:51 | 23.06.2017 12:20:42 | 0,04        |
| 2     | 3     | 23.06.2017 12:20:42 | 23.06.2017 13:25:53 | 0,02        |
| 3     | 4     | 23.06.2017 13:25:53 | 23.06.2017 13:19:12 | 0,05        |

select sum(distance_km) as total_km
from   distances
where  p_time_ &gt;= '2017-06-23 12:00:00' 
and    c_time_ &lt;= '2017-06-23 14:00:00'
;

| total_km |
|----------|
| 0,11     |


Rextester here