Timing of the formation and migration of giant planets as constrained by CB chondrites