public function getEnd()
    {
        // if end property is defined, use it
        if ($this->end) {
            return clone $this->end;
        }

        $numberOfPosts = count($this->getPoints());

        // try to find last time of point and use it as end date
        if ($this->haveGPSData()) {
            return $this->getPoints()[$numberOfPosts - 1]->getTime();
        }

        // if there are no points, calculate end date from duration
        return $this->getStart()->add(new \DateInterval('PT' . $this->getDuration() . 'S'));
    }