Development of hard X-ray spectrometer with high time resolution on the J-TEXT tokamak