mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Correct the netflow 9 timestamp.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use lqos_utils::unix_time::time_since_boot;
|
||||
use lqos_utils::unix_time::{time_since_boot, unix_now};
|
||||
use nix::sys::time::TimeValLike;
|
||||
|
||||
#[repr(C)]
|
||||
@@ -15,12 +15,13 @@ impl Netflow9Header {
|
||||
/// Create a new Netflow 9 header
|
||||
pub(crate) fn new(flow_sequence: u32, record_count_including_templates: u16) -> Self {
|
||||
let uptime = time_since_boot().unwrap();
|
||||
let unix_secs = unix_now().unwrap_or(0);
|
||||
|
||||
Self {
|
||||
version: (9u16).to_be(),
|
||||
count: record_count_including_templates.to_be(),
|
||||
sys_uptime: (uptime.num_milliseconds() as u32).to_be(),
|
||||
unix_secs: (uptime.num_seconds() as u32).to_be(),
|
||||
unix_secs: (unix_secs as u32).to_be(),
|
||||
package_sequence: flow_sequence.to_be(),
|
||||
source_id: 0,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user