Characterization of the longitudinal dynamics of nanosecond electron bunches traveling in a Malmberg-Penning trap