I have a function $f(t)$ which returns a 3D coordinate $(x,y,z)$ for every $t$. This corresponds to a celestial body's position in its orbit, so it's somewhat elliptic but it will not be absolutely self-enclosing because there are perturbations.
Given a starting point $t$ I want to figure out how long time $\Delta t$ it takes before the body has completed one revolution around the origin in it's orbital plane.
To make this clear: $f(t)$ is a numeric function, the interpolated solution of a differential equation. I cannot manipulate its analytic form.
(So far I've tried to apply techniques related to the winding number, as well as trying to use the fact $cos(\theta)=\frac{\mathbf{v_1}\mathbf{v_2}}{v_1 v_2}$ but I haven't succeeded.)
If the perturbations are large, the orbit may not even be in one (approximate) plane. Think of the Ulysses probe, which flew by Jupiter to make a major plane change out of the ecliptic. In that case it is hard to define one circuit, but maybe the best is to take each short timestep $\Delta t$, calculate the angle traversed as $\frac {v_t}r\Delta t$ (where $v_t$ is the tangential velocity around the origin) and add them up until you reach $2\pi$, calling that one circuit. This will work fine even if the orbit is (approximately) in one plane.