Also you should not reset the counter at every event, this would lead to a poisson distribution if event ever became of comparable time scale to the timer
Looks very similar to mine in the principles of operation! I wonder if the author got some inspiration from my work, that would be amazing!