How to display numbers on a 7 segment display for certain amount of time

I’m trying to display the average reading from a GSR sensor on a 4 digit 7 segment display for only 10 seconds. I can get average to be displayed but I can’t control how long the number is displayed. How can I modify my code to do this?

void loop() {
double starttime = millis();

else if (10001 < starttime < 11000)
{
sevseg.setNumber(gsr_average);
sevseg.refreshDisplay();
}
}

if (10001 < starttime < 11000) almost certainly does not do what you expect/imagine.

Needs more &&

Also millis does not return a double.

The way you are using starttime will only work for the first 10 seconds from the start of the arduino.

A better way to do this would be to remember the last 'start' of period in a variable (startPeriod) and then compare (millis() - startPeriod) to work out how much time has elapsed. Once yo have finished a cycle, you reset startPeriod to the current millis() and the whole cycle can start again.

See my code here for imnatalie01's identical question. (Except she reduced her question to a :o )

I used random() to generate values as a proxy for the actual sensor, but just swop random() out and put your sensor read in....

My code there waits for a button press, takes values in every "x" ms for a total of "y" ms, calcs average, displays for "z" ms (edit: and goes back to waiting for a button press for the next cycle).