Your issue is better thought in terms of events and objects.
Let's say you have a Chronometer and it has at least three parts: Display, button and code. The display will show the value of the chronometer. The button will behave as you describe. The code is the part that manages everything.
Your chronometer code will be receiving events from at least two sources: Timer and Button. The timer is a system time that sends you message periodically (like once a second). The button will send your chronometer code an event when the user clicks on the button.
So you will need to have some static variables to hold your information.
You will need to think in terms of the event:
if event == button click
then increment click and check click count.
endif
if event == timer
then
increment chronometer value.
if chronometer value == limit, then stop the timer.
endif
The implementation of the algorithm depends on the GUI framework you are using.