I have to build a timepicker where user clicks on a clock like circle and it gives a time.
Once I have cursor position I think that all I have to do is to calculate an angle between time 00:00 and a line which goes though middle of the clock and a cursor position. Does it sound right?
Any clue on how to do it?
Sure, that sounds good. So this is a 12 hour clock? You can put the clock at the origin, then find $\theta$. Unfortunately, in math we prefer to go $counter-clockwise$ and clocks go $clockwise$.
If we defined our angle from the positive $x$ axis as $$ \phi = atan2(y,x) $$
We'd be off by $90^o$ at noon and going the wrong way. Instead, we can "transpose" $\phi$ or instead just do $$ \theta = atan2(x,y) $$ You can then divide this $\theta$ by $\frac{2\pi}{12}$ to get which hour it is.