Square wave generator and frequency meter

And thats a false claim, i assign value to timervalue when i get interrupt on pin D2 not when timer1 overflows.
In timer1 overflow ISR is only 1 line of code:

ISR(TIMER1_OVF_vect){
  timeovf++;
}