Shock formation in electron-ion plasmas: mechanism and timing