I think I'd use a timer that can go over an hour. Then each scan, check if the timer Acc is over an hour. If it is, add one to your hour counter (really just a N, V or D register), and subtract an hour worth of ms from the Acc. That way you avoid building up error because of scan latency delaying the check.