Help with my project. URGENT.

Is it possible to pause the timer from millis and resume at the time it paused?
I am making a servo working with sensor(LDR)

First, servo will turn to 180 degrees for 0.5 second and then turn 90 degrees which indicates the start of the loop.

At 90 degrees, the sensor controls the time such as when sensor senses light, the timer works otherwise the time will pause and will only continue when it sense light. The timer has 10 seconds duration. After 10 seconds, the servo will turn 180 degrees for 5 seconds(constant). After 5 seconds, it will turn back to 90 degrees and the process is the same as before (loop)

The problem is when I cover the sensor when at 90 degrees, the time resets to 0(zero) and will count again to 10.
Is there any way I can resume the time from the time it paused (where sensor is covered) and will continue until 10 seconds
Here is my code and please help me configure it.
Thanks in advance.

(I'm new to Arduino and this is my first time to post here)

(I'm new to Arduino and this is my first time to post here)

No, it's not, and I asked you not to start a new thread.

OK, old thread deleted.

Please post your code in code tags.

Is it possible to pause the timer from millis and resume at the time it paused?

Do you often go to the clock on the wall, or your wristwatch, and stop the hands from going round?

#include <Servo.h>

Servo myservo;

// These constants won't change:
const int analogPin = A0;    // pin that the sensor is attached to
const int ledPin = 13;       // pin that the LED is attached to
const int threshold = 400;   // an arbitrary threshold level that's in the range of the analog input
unsigned long startTime = 0;
unsigned long storedTime = 0;
unsigned long storedTimeTemp = 0;

void setup() {

  myservo.attach(9);
  myservo.write(180);
  delay(500);
  myservo.write(90);
   
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  
  // initialize serial communications:
  Serial.begin(9600);
}

void loop() {

  unsigned long loopTime = millis() - startTime;
  
  
  // read the value of the LDR sensor:
  int analogValue = analogRead(analogPin);

  // if the analog value is high enough, turn on the LED:
  if (analogValue > threshold) {
    digitalWrite(ledPin, HIGH);

//    
//    if(loopTime < 1000){
//      loopTime = millis() + storedTimeTemp;
//    }
//    storedTime = loopTime;

    Serial.print("loopTime inside if ");
    Serial.println(loopTime);
    
  } else {
    digitalWrite(ledPin, LOW);
    startTime = millis();

    interrupts();
    
    Serial.print("loopTime inside else ");
    Serial.println(loopTime);
//    Serial.print("starTime inside else ");
//    Serial.println(startTime);
    
  }
  
  if(loopTime > 10000 && loopTime <= 10020){
    myservo.write(180);
    delay(5000);
    myservo.write(90);
    startTime = millis();
  }
  
}

AWOL:
No, it's not, and I asked you not to start a new thread.

OK, old thread deleted.

Please post your code in code tags.

Sorry Mr. AWOL. I'm not yet familiar here and still trying to understand everything here. Yes it is not my 1st post knowing that my 1st post is not right but please be considerate. Thanks.

AWOL:
Do you often go to the clock on the wall, or your wristwatch, and stop the hands from going round?

No sir but I don't know how do I make it work as to it's algorithm. Maybe there are other ways to do it.

read what an XY problem is.
the concept is that you have an answer and are in search of a question, but ask the answer in the form of a question.

instead of offering your solution that you cannot figure how to make,
explain your actual problem.

you want to have a timer of 10 seconds, and if you stop, you want to know how long it ran for, and then pick up and run the rest of the time.

THAT is not hard to do.

iampaul_ohhh:
Is it possible to pause the timer from millis and resume at the time it paused?

yes, just change the way you use millis()
if (switch== high ){
then = millis()
}

if (stop_flag==LOW){
duration = millis() - then;
}
now you have a variable called duration.
it will store the time and you can perform math on that time
if( LDR == HIGH){
stop_flag=HIGH;
}
now, when your LDR interrupts your sketch, you store the last value of duration
what you need to figure is how to pass that back to your motors

dave-in-nj:
yes, just change the way you use millis()
if (switch== high ){
then = millis()
}

if (stop_flag==LOW){
duration = millis() - then;
}
now you have a variable called duration.
it will store the time and you can perform math on that time
if( LDR == HIGH){
stop_flag=HIGH;
}
now, when your LDR interrupts your sketch, you store the last value of duration
what you need to figure is how to pass that back to your motors

Thanks for this sir. Very much appreciated.