Closing a solenoid after a set time interval ends

I'm trying to control three solenoids to water my plants in my house. The flow rate for the second line is below the threshold for my flow meter so I'm trying to change it to a time based interval.

The volume and time variables are being set with the Blynk app. Lines 1 & 3 that are volume based are working as intended, but I'm having a hard time getting the time based one to stop after the time interval lapses.

The section of code if the defined variables is below

long L2_wateringTime;
L2_wateringTime = t.getStartHour() * 3600 + t.getStartMinute() * 60 + t.getStartSecond();
long L2_TimeOpenDuration_Sec = 0;

//Controls the Line 2 Solenoid that is time dependent and should close after the L2_TimeOpenDuration_Sec passes
    else if (L2_run) { // Solenoid 2 is supposed to be open
      long currentTimeInSec = hour() * 3600 + minute() * 60 + second(); //was not declared in this scope
        if (currentTimeInSec >= (L2_wateringTime + L2_TimeOpenDuration_Sec)) { //gets current time in seconds and if it is greater than or equal to the start time in seconds plus the interval time solenoid should be open, should close
        AllVaulvesOff();
        L2_wateringTriggered = false;
        RunWateringSequence();
      }
      else {
        Serial.print("Water L2 (mL) -> ");
        Serial.println(waterDispensed * 1000);
      }
    }
}

Thanks

What happens before:

else if (L2_run) { // Solenoid 2 is supposed to be open

? What does:

RunWateringSequence();

And:

AllVaulvesOff();

Do? Post entire code.

The code had too many characters to post, but I attached it.

What happens before:
else if (L2_run) { // Solenoid 2 is supposed to be open

Before this, the volume that is dispensed by the first solenoid is set.

RunWateringSequence(); //checks if the solenoid has been selected in the Blynk app and if so, grabs the start time and independent volume or time variable that is user defined.

AllVaulvesOff(); //sets the three pins to the three solenoids to "low" / closed

WateringSystemMay2posted.ino (14.9 KB)

  TimeInputParam t(param);
  L1_wateringTime = t.getStartHour() * 3600 + t.getStartMinute() * 60 + t.getStartSecond();

What type does t.getStartHour() return? If it is an int, and it is 10:00 or later, the first multiply will overflow.

Why are all your time variables long? Do you expect to start watering yesterday? Time variables should ALWAYS be unsigned long, unless time runs backwards in your part of the universe.

That makes a lot of sense, it is my first time working with a RTC. Still a lot to learn.