unsigned int sec = 0;
unsigned int min = 0;
unsigned int hour = 0;

void setup() {
  DDRD = 0b11111111;
  PORTD = 0;
  DDRB = 0b11111111;
  PORTB = 0;
  DDRC = 0b11111;
  PORTC = 0;
}

void loop() {
  PORTC = (sec/10)<<3 | (sec%10)>>1;
  PORTB = (min/10)<<2 | (min%10)>>2 | ((sec%10)&1)<<5;
  PORTD = (hour/10)<<4 | (hour%10) | ((min%10)&3)<<6;
  
  delay(1000);
  sec++;
  if(sec == 60)sec = 0, min++;
  if(min == 60)min = 0, hour++;
  if(hour == 24)hour = 0;

  }