The Chern-Simons invariant as the natural time variable for classical and quantum cosmology