[SOLVED] need help with second counting algorithm

This is some pseudo code. This should work I think:

if(event triggered) {
  showUntil = current hour, current minute, current second + 30;
}

if( showUntil >= (current hour, current minute, current second) ) {
	displaySeconds();
}

If I can get the seconds elapsed since the epoch from the DS1307, the above should be easy enough to code.