The residence time measures the time spent by a water parcel or a pollutant in a given water body and is therefore widely used in environmental studies. The adjoint method introduced by Delhez et al. (Estuarine Coastal and Shelf Sciences, 2004) to compute this diagnostic is revised here to take into account the effect of the initialisation and of the boundary conditions. In addition to the equation for the mean residence time, it is suggested to solve a simple advection-diffusion problem to quantify the effect of the initialisation and clarify the interpretation of the results. Using the two same equations but with modified boundary conditions, the method can also be used to quantify the accumulated time spent by water/tracer parcels in a control domain. This diagnostic is called "exposure time".