This uses a timer tick and adds and subtracts to counters. Their units are now time related.
Also poll input looking for changes to reset the counters
This integrates up dTinput while the input is pressed, and slowly leaks, this keeping the ouput high while dTinput > 0.
When the mouse is over the input button, dTinput is incremented per timer tick by 5 counts. Each timer tick, it is decremented by 1 and while it is greater than 0, the output is high.
This is an example of a leaky bucket