[SOLVED] need help with second counting algorithm

There is no delay in the loop

Yes, there is:

  while(duration++ <= currentSecond) {
     displaySeconds(); // an external function that shows current seconds on the display
  }

You want to make showSeconds() just show the current time, as seconds. The call to that function should be dependent on the time. Exactly how to do that depends on code you didn't post.