The physics
In SHM, the force on a body points back to one rest point. That force grows with the distance. Then F = −kx, even with no spring in sight.
F = −kx T = 2π√(m/k)
So find the hidden k. From an energy U(x), the bead rests where U′ = 0. There, k = U″.
k = U″(x₀)
A float: the water's extra push up is ρAg for each metre it sinks. So k = ρAg. A U-tube: the levels differ by twice the push, and all the liquid moves. So ω² = 2g/L.
A rolling body also spins. Its spin adds to the moving mass: m + I/r². For a disc that is 1.5m.
Inside a uniform planet, the pull grows with the distance from the centre. So F = −(mg/R)x. A ball in a tunnel through the centre swings with T = 2π√(R/g).
float: T = 2π√(h/g) U-tube: T = 2π√(L/2g) tunnel: T = 2π√(R/g)