A little bit of a venture into perhaps dwarven mechanical sillyness, along with invisibly connecting levers.
But this is a particular gear (or mechanism not decided yet) that can be programmed to apply a delay before it activates, as per carefully constructed dwarven mechanisms buried within it itself being a mechanism will affect anything its built within or connected directly to.
1, 2, 3 with the idea that 1 3 delayed gear + 1 delayed gear next to each other delivers a accurate number four in delay whilst still transmitting power down the chain from the water/windmill after being disrupted by the delay, the gears ahead carrying the energy keep working but the delay gears stop & start.
Using this particular mechanism or gear configuration in a actual object would apply the delay, in such a case that while not all DF traps are immediate, applying a delay may be tactical to giving yourself more time to prepare for the effect (get your squad into position) or prime your traps in a calculated manner rather than all at once. If you wanted to time autonomous water pump stacks for instance by creating stable flows to make it shut off between pumping that's possible.
A alternative idea is a a literal individual clock machine built out of many mechanisms & metal for the clock hands that is programmable and automates the gears/equipment next to it to follow its delay beat, a worthy target for a technological breakthrough by your scholar mechanics perhaps.