Countdown timer

I am trying to create a countdown timer using ofGetElapsedTimef() as a counter.
I need the timer to start not when the application is launched but after the user clicks on a certain key.
The problem is ofGetElapsedTimef() will give me the time elapsed since the application is launched. Is there a way to control when the time starts?
I’d appreciate your help.

You can just take the difference between ofGetElapsedTime() and the time when the user clicks the key. Then you’ll know the offset of time.

For example, when the user clicks the key, get the ofGetElapsedTime() and save that number. In the future, subtract from that number to get the difference between the current time and when the key was clicked.

Thank you so much! It worked :slight_smile:

No problem. Glad you you have it working. :slight_smile: