diff options
author | Chris Wailes <chriswailes@google.com> | 2023-03-30 18:46:33 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-03-30 18:46:33 +0000 |
commit | edce4876633634dff52e83cb3a47b87649cd1d47 (patch) | |
tree | ac61a98468f63fbeea64c38c2f5bcb7ab0d66f59 /profcollectd | |
parent | c0766c1ceade3488565a421bacbb8f30026f6928 (diff) | |
parent | ddf6bb9efed876f99535fbb30e3b55c1bd79119f (diff) | |
download | extras-edce4876633634dff52e83cb3a47b87649cd1d47.tar.gz |
Merge "Update usage of uuid crate"
Diffstat (limited to 'profcollectd')
-rw-r--r-- | profcollectd/libprofcollectd/report.rs | 7 |
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)) |