byte sec = 0, min = 0, hour = 0;
byte sE, mE, hE;
byte sZ, mZ, hZ;

void setup() {
  int MaskD = 0x1F;
  int MaskC = 0x01;

  DDRD = MaskD;
  DDRC = MaskC;

  PORTD = 0;
  PORTC = 0;

}

void loop() {
  delay(1000);
  sec++;
  if (sec >= 60) {
    sec = 0;
    min++;
    if (min >= 60) {
      min = 0;
      hour++;
      if (hour >= 24) hour = 0;
    }
  }

  sE = sec % 10;
  sZ = sec / 10;

  PORTD = (sE >> 1) | (sZ << 3);
  PORTC = sE;

}