Right. In that case you can check if every unit in the map has the buff "stunned" Do that every 0.1 seconds or so.
@Axe I don't know if that will work either. Catching buffs in a DDS will require storing all stun durations.
Chaosy's solution is a bit easier. And since the problem cannot be solved without overly-complex code, I suggest the damage to be every 0.1s. Thus it would increase the longer the stun time.
Then the damage could be lowered to make it a stun duration based-counter.