5 Minute using Millis

In the following code I run a GPS for 5 minutes to ensure that it downloads the ephimeris data.
This code only runs once.
For some reason, my millis timer is not stopping

unsigned long gpsOnTime;
unsigned long gpsRunInterval = 1000UL * 60 * 5; // 5 minute interval

boolean gpsDownloadInitial = false;

void setup() {
  Serial.begin(115200);

}

void loop() {
  // put your main code here, to run repeatedly:
  if (gpsDownloadInitial == false)
  {
    gpsDownloadInitial = true;
    downloadGPS();
  }

}

void downloadGPS() {
  gpsOnTime = millis();
  Serial.println("Start GPS Download");

  if (gpsOnTime > 0) // The GPS is Downloading
  {
    if (millis() - gpsOnTime > gpsRunInterval) // It's time to stop GPS downloading
    {
      // stop GPS downloading and clear the gpsOnTime time
      Serial.println("Stop GPS Download");
      gpsOnTime = 0;
    }
  }
}
      gpsOnTime = 0;

Shouldn't you be setting this to the current time otherwise

if (millis() - gpsOnTime > gpsRunInterval)

Will be true immediately

UKHeliBob:

      gpsOnTime = 0;

Shouldn't you be setting this to the current time otherwise

if (millis() - gpsOnTime > gpsRunInterval)

Will be true immediately

Reread the sketch... It actually guards against that, but is totally bogus in other ways.

Firstly downloadGPS() is correctly guarded by the boolean gpsDownloadInitial, so that it is only
called once (which is much easier to do by calling it in setup() anyway, but whatever)

Secondly downloadGPS() seems to assume that millis() cannot return zero. Incorrect assumption.

Thirdly downloadGPS() exits immediately having done nothing, never to be called again, so the
test for stopping downloading can never happen again.

For some reason, my millis timer is not stopping

What does that actually mean?