Code to detect single or double click

I solve problems like this with timing diagrams. Then you are simulating input signals and showing how they would/should be interpreted.

The essence of it, is defining things we take for granted, button clicks are a great example. This is why you can be asking about such a simple thing.

Ask yourself first, what absolutely defines a single button click? Then move on to the double.

Is this a school assignment? It has the odor of a challenge question.