Implement external interrupt with time counting.