We develop a theory for transit times and mean ages for nonautonomous
compartmental systems. Using the McKendrick-von F\"orster equation, we show
that the mean ages of mass in a compartmental system satisfy a linear
nonautonomous ordinary differential equation that is exponentially stable. We
then define a nonautonomous version of transit time as the mean age of mass
leaving the compartmental system at a particular time and show that our
nonautonomous theory generalises the autonomous case. We apply these results to
study a nine-dimensional nonautonomous compartmental system modeling the
terrestrial carbon cycle, which is a modification of the Carnegie-Ames-Stanford
approach (CASA) model, and we demonstrate that the nonautonomous versions of
transit time and mean age differ significantly from the autonomous quantities
when calculated for that model