refactor(replay/recorder): inline self.get_timestamp

This commit is contained in:
Ryan 2025-03-11 18:45:51 -04:00
parent 0fbd632c59
commit 6cd4394b86
Signed by: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3

@ -65,13 +65,9 @@ impl Recorder {
Ok(())
}
fn get_timestamp(&self) -> Result<[u8; 4]> {
Ok(TryInto::<u32>::try_into(self.start.elapsed().as_millis())?.to_be_bytes())
}
pub fn save_raw_packet(&mut self, raw_packet: &[u8]) -> Result<()> {
let mut data = Vec::with_capacity(raw_packet.len() + 8);
data.extend(self.get_timestamp()?);
data.extend(&TryInto::<u32>::try_into(self.start.elapsed().as_millis())?.to_be_bytes());
data.extend(&TryInto::<u32>::try_into(raw_packet.len())?.to_be_bytes());
data.extend(raw_packet);
self.zip_writer.write_all(&data)?;