millis() as time-out

I have the following function which runs great and the GPS data is parsed as expected.
I am having a problem with the millis().
My requirement is to run the "parseGPS()" function for a maximum of 10 seconds.
After the 10 seconds have elapsed, I must print the parsed data to the Serial Monitor.

I am using:

unsigned long startedGPS = millis ();
.....
  if (millis () - startedGPS >= 10000)  // run GPS for 10 seconds
  {
    if (longLat != 0 && longLon != 0) {
      Serial.println(longLat, HEX);
      Serial.println(myNS);
      Serial.println(longLon, HEX);
      Serial.println(myEW);
    }
  }

My complete function:

void parseGPS() {    
  Serial.print("Received Data: ");
  Serial.println(tempGPS);

  String MyGPS = tempGPS;
  int posGNGLL = 0;
  String myLat;
  String myNS;
  String myLon;
  String myEW;
  long longLat = 0;
  long longLon = 0;

  unsigned long startedGPS = millis ();


  if (MyGPS.startsWith("GNGLL")) {
    posGNGLL =  MyGPS.indexOf('GNGLL');

    myLat = MyGPS.substring(posGNGLL + 3, posGNGLL + 12);
    myLat.replace(".", "");
    longLat = myLat.toInt();

    myNS = MyGPS.substring(posGNGLL + 13, posGNGLL + 14);
    if (myNS == "S") {
      myNS = "53";
    }
    if (myNS == "N") {
      myNS = "4E";
    }

    myLon = MyGPS.substring(posGNGLL + 15, posGNGLL + 25);
    myLon.replace(".", "");
    longLon = myLon.toInt();

    myEW = MyGPS.substring(posGNGLL + 26, posGNGLL + 27);
    if (myEW == "E") {
      myEW = "45";
    }
    if (myEW == "W") {
      myEW = "57";
    }
  }

  
  if (millis () - startedGPS >= 10000)  // run GPS for 10 seconds
  {
    if (longLat != 0 && longLon != 0) {
      Serial.println(longLat, HEX);
      Serial.println(myNS);
      Serial.println(longLon, HEX);
      Serial.println(myEW);
    }
  }

  longLat = 0;
  myNS = "";
  longLon = 0;
  myEW = "";

}

Could someone point out what I am doing incorrectly?

Could someone point out what I am doing incorrectly?

Posting incomplete code.

Making a new unsigned long startedGPS = millis ();
every time the function runs.

Comparing that to millis() a few milliseconds later.

What do you mean by "run the "parseGPS()" function for a maximum of 10 seconds"?

There are just a couple of if statements that will either execute, or not. The entire function may take only a few milliseconds, depending on the serial baud rate.

BTW use of Strings is not advised with standard Arduinos. They cause memory problems and program crashes.