You need to follow these code:
`// Variables for time settings
float $startHour = 12.0;
float $endHour = 1.5; // 1:30 in decimal
float $fps = 24; // Assuming 24 frames per second
// Calculate the total frames for real-time playback
float $totalTime = ($endHour - $startHour) * 3600; // Convert hours to seconds
int $totalFrames = $totalTime * $fps;
// Animate the hour hand
for ($frame = 0; $frame <= $totalFrames; $frame++) {
float $currentHour = $startHour + (($frame / $fps) / 3600);
float $rotation = $currentHour * 30; // 30 degrees per hour
currentTime $frame;
setAttr "hourHand.rotateZ" $rotation;
setKeyframe "hourHand.rotateZ";
}
// Repeat for the minute hand similarly
`
I also check this: https://forum.highend3d.com/t/animating-a-clock-using-mel-scriptgolang