function process_fix(GpsFix $fix)
 {
     $this->log->lwrite("Processing FIX " . $fix);
     // 1.- Store the point
     $fix->store();
     $fix->store_on_temp_table();
     // 2.- Collect all fixes of this trajectory
     $fixes = get_temp_table_fixes();
     $size = count($fixes);
     if ($size == 1) {
         return null;
     } else {
         $stay_point = $this->process_live($fixes);
         return $stay_point;
     }
 }
    $date_now = new DateTime("now", $time_zone);
    $converted_date = $date_now->format('Y-m-d H:i:s');
    $log = new Logging();
    $log->lfile('logs/mylogTrajectory.txt');
    $log->lwrite("fecha es: " . $converted_date);
    insert_new_trajectory($converted_date, $converted_date, $min_distance, $min_time, $max_time);
    echo "trajOk";
} else {
    $last_trajectory = get_last_trajectory();
    $min_time = $last_trajectory["minTime"];
    $max_time = $last_trajectory["maxTime"];
    $min_distance = $last_trajectory["minDistance"];
    $ml = new MontoliouLive($min_time, $max_time, $min_distance);
    if (!isset($_POST['lastPart'])) {
        if (validate_fix_input()) {
            $fix = GpsFix::create_fix_from_parameters();
            $stay_point = $ml->process_fix($fix);
            if ($stay_point != null) {
                echo $stay_point;
            } else {
                echo -1;
            }
        } else {
            echo -2;
        }
    } else {
        $stay_point = $ml->process_last_part();
        if ($stay_point != null) {
            echo $stay_point;
        } else {
            echo -1;