summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-12-13 13:00:04 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-12-13 13:05:05 +0100
commit4c4c7074c4cbb5e729871bdbe10f0ca1e66cf4c8 (patch)
treeec5647e3d8994261fad0925be7a5b962c3dd8868 /openpgp
parent6fceb6c51b51baeea9bca057180d8d408e13d68d (diff)
openpgp: Make Key4::set_creation_time more flexible.
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/packet/key/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/openpgp/src/packet/key/mod.rs b/openpgp/src/packet/key/mod.rs
index 2fa3ce5b..af08e693 100644
--- a/openpgp/src/packet/key/mod.rs
+++ b/openpgp/src/packet/key/mod.rs
@@ -1008,9 +1008,12 @@ impl<P, R> Key4<P, R>
}
/// Sets the key packet's creation time field.
- pub fn set_creation_time(&mut self, timestamp: time::SystemTime)
- -> Result<time::SystemTime> {
- Ok(std::mem::replace(&mut self.creation_time, timestamp.try_into()?)
+ pub fn set_creation_time<T>(&mut self, timestamp: T)
+ -> Result<time::SystemTime>
+ where T: Into<time::SystemTime>
+ {
+ Ok(std::mem::replace(&mut self.creation_time,
+ timestamp.into().try_into()?)
.into())
}