  Context. Measuring star formation across the Universe is key to constrain
models of galaxy formation and evolution. Yet, determining the SFR (star
formation rate) of galaxies remains a challenge. Aims. In this paper we
investigate in isolation the impact of a variable star formation history on the
measurement of the SFR. Methods. We combine 23 state-of-the-art hydrodynamical
simulations of 1<z<2 galaxies on the main sequence with the cigale spectral
energy distribution modelling code. This allows us to generate synthetic
spectra every 1 Myr for each simulation, taking the stellar populations and the
nebular emission into account. Using these spectra, we estimate the SFR from
classical estimators which we compare with the true SFR we know from the
simulations. Results. We find that except for the Lyman continuum, classical
SFR estimators calibrated over 100 Myr overestimate the SFR from ~25% in the
FUV band to ~65% in the U band. Such biases are due 1) to the contribution of
stars living longer than 100 Myr, and 2) to variations of the SFR on timescales
longer than a few tens of Myr. Rapid variations of the SFR increase the
uncertainty on the determination of the instantaneous SFR but have no long term
effect. Conclusions. The discrepancies between the true and estimated SFR may
explain at least part of the tension between the integral of the star formation
rate density and the stellar mass density at a given redshift. To reduce
possible biases, we suggest to use SFR estimators calibrated over 1 Gyr rather
than the usually adopted 100 Myr timescales.
