Yes, by using a clock, no problem with my approach.
As a rule, an extension should do something that either doesn’t exist yet or something that can be simplified a lot. Look at your blocks:
Anyway, thank you for this extension and that you provided the java code!