The solution provided sounds correct and it is called a buffering input.
Although you should actually reset your variable to 0 in the "On release" no matter what, using a blank event for example.
Key is pressed => Add dt to variable (Delta Time)
Key on release
... Variable < 0.5 => Do dash
... Variable => 0.5 => Do Slow time
... (blank) => Reset Variable
This way your variable will only build up when you are pressing the key.
And the time there are akin to pressing the key for half a second. Using dt, you are getting an exact value of 1 added each second the key is down in a consistent manner over all computers.