1
\$\begingroup\$

Given:

  • a 12 hour time t in hours and minutes,
  • a rotation r in degrees,

return the time shown when an analog clock that is displaying the time t is rotated r degrees clockwise.

After rotation, the hour hand will not line up with the new position of the minute hand. To correct for this, the new hour can be derived from the new position of the hour hand.

This is . The shortest solution wins. Standard loopholes apply.

Inspired by unmarked analog clocks like this one: Unmarked analog clock]

\$\endgroup\$

closed as unclear what you're asking by streetster, xnor, Jonathan Allan, dkudriavtsev, flawr Sep 16 at 7:07

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    \$\begingroup\$ The hour hand doesn't really line up if you rotate the whole thing. Should we be basing the hour on which hours it is between? Some test cases might be nice too \$\endgroup\$ – Jo King Sep 16 at 3:09
  • \$\begingroup\$ @JoKing I added a line to clarify \$\endgroup\$ – dkudriavtsev Sep 16 at 3:13
  • \$\begingroup\$ How can we represent the time? A pair of integers, numbers of minutes since 1200, a native time object, a string like "0130" or "1:30"? \$\endgroup\$ – Jo King Sep 16 at 4:32
  • 5
    \$\begingroup\$ Test cases should be provided. \$\endgroup\$ – Joel Sep 16 at 4:44
  • 4
    \$\begingroup\$ This needs more clarification and some test cases. We have 360 degrees and 60 minutes, which means rotating by 6 degrees should move the minutes handle to the next minute. But what if we rotate by 3 degrees? Will it be same minute or the next minute? \$\endgroup\$ – Night2 Sep 16 at 5:23