Hi, using this script by Dan Ebberts I got it kinda working the way you want to, but a little bit different. The clock works now by a slider-value, which dictates how long a 6hour cycle will take.
Expression for the minute hand:
cyc= thisComp.layer("Null 1").effect("6h-cycle length")(1); //the aforementioned slider, here with the value 5(sec)
t=time%cyc; //t as a time driven variable will jump back to zero every "cyc" seconds
seg = Math.floor(time/(cyc)); //calculating the number of rounds, important for the last step
(180*12)*seg+linear(t,0,cyc,0,(180*12)) //"linear"-ing the rotation and adding the amounts of full rotations
180*12 for 6 full rotations, I was to lazy to tidy this up. I also forgot to calculate for the layer.inPoint, for example if you move your layer around on the timeline.
Expression for the hourhand:
thisComp.layer("min").transform.rotation/12 //Nothing special, just dividing the minute rotation by 12
And the most important, expression on the sun/moon-thingy:
rampDur = thisComp.layer("Null 1").effect("6h-cycle length")(1); //same
segDur = 2*rampDur;// double it up for a full 12h circle. Since the widget will be resting for 6 hours and rotating for the other six
t = (time+rampDur - inPoint)%segDur; //same as before but this time I "offset" the whole thing by a 6 hour cycle, since it should start stationary
seg = Math.floor((time+rampDur-inPoint)/segDur); //again as before but added the "rampDur" as a 6-hour-cycle offset
180*seg + ease(t,0,rampDur/1,0,180)// decided to use ease instead of linear since it looks nicer. I explain below why I left the devision after rampDur in
I hope you understand evertything with my comments, but I’ll attach a file as well. Now, if you want to speed up or slow down your clock animation change or animate the slider on the Null. If you feel your sun/moon rotation should be faster than a 6-hour-cycle, just divide the last rampDur in the ease by the desired amount, eg in this case by 5 to have the rotation be 1 second long. In this example I put the 1 to leave it just as it is.
Project file:
14125_clockwidget.aep.zip
I hope I could help, I definetly learned a few new things while working on this problem ???? Thanks to Dan for his awesome expression powers, I hope its okay I borrowed from your last solution… and didnt even bother to rename the variables. Sorry!????