Exiting a function on a key press.

All capital letters names are, by convention, reserved for constants. DISPLAY_TIME is not a constant. The convention for function names is camelCase, so the function should be displayTime().

You have two nearly identical blocks of code - one to display 0 to 9 on one side and one to display 0 to 9 on the other side. They differ only in the select pin. Create a function that takes a select pin, and get rid of half of the code.

  int key = KEY_SCAN();
  if (key = 1)
  {
    predelay = predelay + 1;
  }
  if (key = 2)
  {
    predelay = predelay - 1;
  }
  if (key = 3)
  {
    //  Exit from here.
    
  }

Why bother calling KEY_SCAN() if you are going to assign new values to key in the if statements? I suspect you wanted ==, not =.