Is it working with timer tick
It would work with a timer tick, but it may not give you the experience that undo usually does.It will depend largely on what your app is doing. It would be simple to implement using a timer tick, so try it and see if it works for you.
I've always driven it from an event, button clicks, menu selections etc. For text, I normally add a keypressed filter and update the undomanager after a preset number of keystrokes or seconds, whichever comes first. That does use a timer, but only starts when a key is pressed after the last timeout.