A method for measuring the time structure of synchrotron X-ray beams