On small oscillations of dynamical systems with time-dependent kinetic and potential energy