Elapsed event time using RTC

void timerwait()
{
unsigned int cntdown = 0;
while (1)
  {
    tmElements_t tm; //--(The tmElements_t object is a structure. You can create an instance of the structure,)-- 
    //--(populate the members of the structure, and then pass the structure to makeTime.)--

    RTC.read(tm); //--(Read time from RTC)--

    lcd.setCursor(0, 2);
    lcd.write("Real Time ");
    RTCtime(); //--(Call RTCtime() function)--
    lcd.setCursor(0, 3);
    lcd.write("Remain ");

    //--(RTCdelay set in inline code prior to timerwait() function call)--
    cntdown = ((timeEnd - timeStart) + RTCdelay);
    lcd.setCursor(8, 3);
    lcd.print(cntdown);
    lcd.write(" ");
    lcd.write("sec  ");
    
    if (pFlag == 0) //--(If 1, pause is active and we want counter to stop)--
    {
       timeStart = ((tm.Hour * 60 * 60) + (tm.Minute * 60) + tm.Second); //--(Convert time to seconds)--
    }
       
    if (flag == 1)
    {
      timeEnd = timeStart; //--(Save an end variable for comparison)--
      flag = 0; //--(flag disables this if statement so end variable is not overwritten)--
    }

    //--(Not a fix for pause issue)--
    if (cntdown > RTCdelay)
    {
       flag = 1;
    }
    //------------------------------

    if (pFlag == 1)//--(Triggered by pause interrupt button)--
    {
       address = 41;
       val = timeEnd;
       writeAddress(address, val); //--(Save timeEnd variable to RTC RAM)--  
       pause();
       address = 41;
       readVal = readAddress(address); //--(Read saved timeEnd variable from RTC RAM)--
       timeEnd = readVal;
    }
    
    if ((timeStart == (timeEnd + RTCdelay)) && (flag == 0)) //--(RTCdelay is seconds, i.e. if RTCdelay = 1800 seconds = 30 minutes)--
    {
      flag = 1; //--(Enable if statement for next time)--
      //--(Set program to kick out of timer and back to inline loop routine, this if statement is only triggered ONCE)--
      //--(Next round, else below will be true again)
      break;
    }

  }

}

This bit of code (function) directly relates to the pause issue I am having.

I don't even have code for issue 1. Well, that's not exactly honest. I've butchered the logger example for one of the libraries in an attempt to get an increasing elapsed time, but no progress in my hack and slash attempt.

Plank