summaryrefslogtreecommitdiff
path: root/profcollectd
diff options
context:
space:
mode:
authorChris Wailes <chriswailes@google.com>2023-01-19 16:37:38 -0800
committerChris Wailes <chriswailes@google.com>2023-01-19 16:42:26 -0800
commitddf6bb9efed876f99535fbb30e3b55c1bd79119f (patch)
treefb54ffe8143ea56c7aa1a5f4893758aa2d09d91e /profcollectd
parent58235e680a4fe91efc1034ed8462c861b567bb83 (diff)
downloadextras-ddf6bb9efed876f99535fbb30e3b55c1bd79119f.tar.gz
Update usage of uuid crate
The API provided by the uuid crate has changed in the most recent release. Bug: 229895468 Test: m libprofcollectd Change-Id: I3d374030b35194b7a9ef9a8fac866977a2b09058
Diffstat (limited to 'profcollectd')
-rw-r--r--profcollectd/libprofcollectd/report.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/profcollectd/libprofcollectd/report.rs b/profcollectd/libprofcollectd/report.rs
index 22789bd8..6686ec62 100644
--- a/profcollectd/libprofcollectd/report.rs
+++ b/profcollectd/libprofcollectd/report.rs
@@ -79,14 +79,17 @@ fn get_report_filename(node_id: &MacAddr6) -> Result<String> {
let since_epoch = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)?;
let ts =
Timestamp::from_unix(&*UUID_CONTEXT, since_epoch.as_secs(), since_epoch.subsec_nanos());
- let uuid = Uuid::new_v1(ts, node_id.as_bytes())?;
+ let uuid = Uuid::new_v1(
+ ts,
+ node_id.as_bytes().try_into().expect("Invalid number of bytes in V1 UUID"),
+ );
Ok(uuid.to_string())
}
/// Get report creation timestamp through its filename (version 1 UUID).
pub fn get_report_ts(filename: &str) -> Result<SystemTime> {
let uuid_ts = Uuid::parse_str(filename)?
- .to_timestamp()
+ .get_timestamp()
.ok_or_else(|| anyhow!("filename is not a valid V1 UUID."))?
.to_unix();
Ok(SystemTime::UNIX_EPOCH + Duration::new(uuid_ts.0, uuid_ts.1))