The magma ocean (MO) is a crucial stage in the build-up of terrestrial planets. Its solidification and the accompanying outgassing of volatiles set the conditions for important processes occurring later or even simultaneously, such as solid-state mantle convection and atmospheric escape. To constrain the duration of a global-scale Earth MO we have built and applied a 1D interior model coupled alternatively with a grey H2O/CO2 atmosphere or with a pure H2O atmosphere treated with a line-by-line model described in a companion paper by Katyal et al. (2019). We study in detail the effects of several factors affecting the MO lifetime, such as the initial abundance of H2O and CO2, the convection regime, the viscosity, the mantle melting temperature, and the longwave radiation absorption from the atmosphere. In this specifically multi-variable system we assess the impact of each factor with respect to a reference setting commonly assumed in the literature. We find that the MO stage can last from a few thousand to several million years. By coupling the interior model with the line-by-line atmosphere model, we identify the conditions that determine whether the planet experiences a transient magma ocean or it ceases to cool and maintains a continuous magma ocean. We find a dependence of this distinction simultaneously on the mass of the outgassed H2O atmosphere and on the MO surface melting temperature. We discuss their combined impact on the MOs lifetime in addition to the known dependence on albedo, orbital distance and stellar luminosity and we note observational degeneracies that arise thereby for target exoplanets.