Detect double-press on axis?

For a game, I would like to detect a double-press of a key to trigger a special action. However, this key is tied to an axis, which does not respond very quickly to keyboard input and is very gradual, so I can’t just see if the key’s been pressed.

The general idea is like in a console FPS where you double-press up on the analog stick to start sprinting.

Maybe you can use the Input.GetKeyDown method to better track the presses and timing if you have issues with the axis tracking.

A bonus is that the method only returns true each time the key is pressed rather than constantly if they hold it down. That might make it easy for you to listen for the first press, mark the time then listen for the second press and calculate the time difference. (Perhaps Time.deltaTime will do that for you)