Fix SYS_TimerTaskHandler

The previous implementation did not handle counter overflow properly,
causing it to hang for 2^32 milliseconds after 256 ms passed.