Suppose we have a simple pendulum executing SHM about its mean position. We can easily notice that the bob of the pendulum swings back and forth making an angle, say $\theta$ about its central perpendicular (mean position). Let $\theta_{max}$ be the maximum angle subtended on either side when the bob reaches the maximum height.
The total time period, as the bob swings across to reach the same angle on the other side is $T$. However consider two angles $\alpha$ and $\beta$, that the bob of the pendulum subtends at some time during the SHM. How can we calculate the time spent by the bob between these angles as a fraction of the total time period?
My initial idea was, SHM can be represented as a circle, and the total time period of each cycle in a sinusoidal motion is $2\pi$. In a single cycle, the bob traverses the path between the two angles twice (back and forth). Thus we can use the following formula to find the fraction of the total time period that the bob spends in this region.
$$t = \frac{2(\alpha - \beta)}{2\pi} = \frac{\alpha-\beta}{\pi}$$
The time spent between two angles is the difference between the two angles divided by the total angle traversed, which is $2\pi$.
However, I was looking for a more rigorous approach to the problem, maybe I could solve it by integration. Any help would be appreciated.