Time dependence of Bragg forward scattering and self-seeding of hard x-ray free-electron lasers