Code to detect single or double click

ever wonder why critical commands in the military are repeated 3 times (e,g, "eject, eject, eject")

then use a long press instead of a double click. the short press is reported as soon as the button is released.