Remove another SystemTime reference

This commit is contained in:
Rayhaan Jaufeerally
2024-07-17 17:00:42 +00:00
parent 77919edd15
commit 993d18e873
2 changed files with 10 additions and 8 deletions

View File

@ -14,7 +14,8 @@
use bgp_packet::nlri::NLRI;
use bgp_packet::path_attributes::PathAttribute;
use std::time::SystemTime;
use chrono::{DateTime, Utc};
/// RouteInfo encapsulates information received about a particular BGP route.
#[derive(Clone, Debug)]
@ -30,9 +31,9 @@ pub struct RouteInfo<A> {
pub rejection_reason: Option<String>,
/// Time at which this path was learned from the peer.
pub learned: SystemTime,
pub learned: DateTime<Utc>,
/// Time at which this path was last updated by the peer.
pub updated: SystemTime,
pub updated: DateTime<Utc>,
/// The current path attributes from the UPDATE message where this path
/// was learned.

View File

@ -45,13 +45,12 @@ use bgp_packet::path_attributes::{
};
use bgp_packet::traits::ParserContext;
use bytes::BytesMut;
use chrono::{DateTime, NaiveDateTime, Offset, TimeZone, Utc};
use chrono::{DateTime, Utc};
use eyre::{bail, eyre};
use ip_network_table_deps_treebitmap::address::Address;
use ip_network_table_deps_treebitmap::IpLookupTable;
use std::convert::TryFrom;
use std::convert::TryInto;
use std::io::ErrorKind;
use std::net::IpAddr;
use std::net::SocketAddr;
use std::sync::Arc;
@ -297,10 +296,12 @@ pub struct PeerStateMachine<A: Address> {
// server_config is the server wide config that we use here for
// reading global options.
server_config: ServerConfig,
/// The current configuration for this peer.
// To apply a new configuration the peer must be shutdown and
// restarted so that the new configuration can take effect.
config: PeerConfig,
// Store the peer's open message so we can reference it.
peer_open_msg: Option<OpenMessage>,
@ -813,7 +814,7 @@ where
// Update the route_info, we need to clone it then reassign.
let mut new_route_info: RouteInfo<A> = route_info.clone();
new_route_info.path_attributes = route_update.path_attributes.clone();
new_route_info.updated = std::time::SystemTime::now();
new_route_info.updated = Utc::now();
self.prefixes_in
.insert(addr, announcement.prefixlen.into(), new_route_info);
}
@ -825,8 +826,8 @@ where
nlri: announcement.clone(),
accepted,
rejection_reason,
learned: std::time::SystemTime::now(),
updated: std::time::SystemTime::now(),
learned: Utc::now(),
updated: Utc::now(),
path_attributes: route_update.path_attributes.clone(),
};
self.prefixes_in