public Double calculateSpeed(NavigationPosition other) {
   if (getTime() != null && other.getTime() != null) {
     double interval =
         abs(getTime().getTimeInMillis() - other.getTime().getTimeInMillis()) / 1000.0;
     Double distance = calculateDistance(other);
     if (distance != null && interval > 0.0) return distance / interval * 3.6;
   }
   return null;
 }
 public Long calculateTime(NavigationPosition other) {
   if (getTime() != null && other.getTime() != null) {
     return other.getTime().getTimeInMillis() - getTime().getTimeInMillis();
   }
   return null;
 }