Shutting down photon after 1 minute if configured wifi not found

To preserve battery,
how to shut down photon after 1 minute if configured wifi access point not found?

System.sleep()? There are various modes stop and standby, wake using the WKP pin or RTC.

I wrote following sketch to sleep the photon after 70 seconds if wifi is not found
however it is not going to sleep mode

SYSTEM_MODE(SEMI_AUTOMATIC);

int secAlive = 70;
bool isConnectTriggered = false;
bool isConnected = false;
int secPassedSinceTrigger = 0;
int secPrev = Time.local() % 86400;

void triggerConnect(){
    Particle.connect();
    isConnectTriggered = true;
    secPrev = Time.local() % 86400;
    secPassedSinceTrigger = 0;
}

void setup() {
    if(isConnectTriggered==false){
        triggerConnect();
    }
}

void loop() {
    if(isConnectTriggered==true){
        if(isConnected == false){
            int secNow = Time.local() % 86400;
            secPassedSinceTrigger = secNow - secPrev;
        }
        
        isConnected = Particle.connected();
            
        if(isConnected == false){
            if(secPassedSinceTrigger>= secAlive){
                int sec24Hours = 86400;
                System.sleep(SLEEP_MODE_DEEP, sec24Hours);
            }
        }else{
            //connected proceed to work
            Particle.publish("connected", String(isConnected));
            Particle.publish("Seconds Passed", String(secPassedSinceTrigger));
        }
    }
    delay(1000);
}

help appreciated