Terahertz Driven Compression and Time-Stamping Technique for Single-Shot Ultrafast Electron Diffraction