Merge pull request #513 from qiujiangkun/pcap_timestamp_bugfix

pcap timestamp bugfix
master
Dario Nieuwenhuis 2021-07-01 16:49:49 +02:00 committed by GitHub
commit 34c24c7c8c
2 changed files with 7 additions and 1 deletions

View File

@ -73,7 +73,7 @@ pub trait PcapSink {
assert!(length <= 65535);
self.write_u32(timestamp.secs() as u32); // timestamp seconds
self.write_u32(timestamp.millis() as u32); // timestamp microseconds
self.write_u32(timestamp.micros() as u32); // timestamp microseconds
self.write_u32(length as u32); // captured length
self.write_u32(length as u32); // original length
}

View File

@ -59,6 +59,12 @@ impl Instant {
self.millis % 1000
}
/// The fractional number of microseconds that have passed
/// since the beginning of time.
pub const fn micros(&self) -> i64 {
self.millis % 1000 * 1000
}
/// The number of whole seconds that have passed since the
/// beginning of time.
pub const fn secs(&self) -> i64 {