You don't know what your own code does :?:
I guess you are calculating the inverse of the frequency since
you don't have to divide (slow) each time you get your time,
but multiply instead.

Your code looks correct to me.
Maybe you should use double because single suffers from
rounding errors using such big numbers.