As someone pointed in another answer, the same solution described by Dr. Yisong Song in the topic 3.4 (https://www.math.washington.edu/~morrow/336_11/papers/yisong.pdf) can be used here by making the clock simulate the bulb states on/off.
I will just copy and paste his explanation here since it fits perfectly:
3.4.2
Explanation:
The idea behind this protocol is that every prisoner besides the
counter will turn ON the bulb exactly once, whenever he can. When the bulb is ON, no
one can turn it OFF except for the counter. Eventually the counter will enter the room,
turn this bulb OFF, and increment the count T . In this way, each prisoner indicates his
presence in the room to the counter by leaving an ON bulb which is eventually recorded
by the counter.
There is only two things we need to do in order to use this solution here:
1. Simulate states ON/OFF: that one is easy, the prisoners just need to agree that when the hour on the clock is between 0 (or 12) and 5 that means ON and between 6 and 11 that means OFF.
2. Mandatory movement: There is a small difference here as you may noticed. The original problem states the prisoner can choose not to change the bulb state, but the problem proposed here states that the clock must always be set 3 hours backwards or 3 hours forward. No problem, a clock that moves 3 by 3 hours has 4 possible positions (12 divided by 3), or 4 states. Two of these states will always mean ON and two will mean OFF, as stated on item 1. Explaning by example: suppose a non leader prisoner already moved the clock to ON state, on his second visit to the room he must not change the clock state at all, if it's ON it must keep ON, if it's OFF it must keep OFF, suppose the hour is 4 (ON) he just need to move the clock to 1 (also ON), and that's it. Same logic applies to the leader when he visits the room and the clock is at one of the two OFF positions.
There's only one more complication here, we don't know the initial state, if it's OFF the solution works perfectly, but if it's ON we have a problem. If it's ON and the first prisoner picked is the leader he will start counting when he shouldn't, if it's a non leader he will not now he's the first and will leave the clock ON without considering he was the one who set it to ON when he actually should. That leads to a very small possibility of counting 100 prisoners when only 99 visited the room. Since we want the perfect solution, the only way is to make each prisoner "turn" the clock ON two times each, and instead of counting until 100, the leader counts until 200 (or maybe 199 will do, I'm not sure and I'm too tired to think).
More details about the complexity can be found on the same link.
That's it.