app\models\Task::getCurrentDuration PHP Method

getCurrentDuration() public method

public getCurrentDuration ( ) : integer
return integer
    public function getCurrentDuration()
    {
        $parts = json_decode($this->time_log) ?: [];
        $part = $parts[count($parts) - 1];
        if (count($part) == 1 || !$part[1]) {
            return time() - $part[0];
        } else {
            return 0;
        }
    }