  The transition of high-mass galaxies from being blue and star forming to
being red and dead is a crucial step in galaxy evolution, yet not fully
understood. In this work, we use the NIHAO suite of galaxy simulations to
investigate the relation between the transition time through the green valley
and other galaxy properties. The typical green valley crossing time of our
galaxies is approximately 400 Myr, somewhat shorter than observational
estimates. The crossing of the green valley is triggered by the onset of AGN
feedback and the subsequent shut down of star formation. Interestingly the time
spent in the green valley is not related to any other galaxy properties, such
as stellar age or metallicity, or the time at which the star formation
quenching takes place. The crossing time is set by two main contributions: the
ageing of the current stellar population and the residual star formation in the
green valley. These effects are of comparable magnitude, while major and minor
mergers have a negligible contribution. Most interestingly, we find the time
that a galaxy spends to travel through the green valley is twice the
$e$-folding time of the star formation quenching. This result is stable against
galaxy properties and the exact numerical implementation of AGN feedback in the
simulation. Assuming a typical crossing time of about one Gyr inferred from
observations, our results imply that any mechanism or process aiming to quench
star formation, must do it on a typical timescale of 500 Myr.
