mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-11-09 20:27:06 +00:00
consensus-slots: cleanup SlotDuration config (#10878)
* consensus-slots: cleanup the SlotDuration config * fix tests * address review comments
This commit is contained in:
1 parent
f00404bfd6
commit
2561e11ed7
19 files changed
+161
-191
No files matched your search
@@ -42,10 +42,16 @@ impl Timestamp {
|
||||
}
|
||||
|
||||
/// Returns `self` as [`Duration`].
|
||||
pub fn as_duration(self) -> Duration {
|
||||
pub const fn as_duration(self) -> Duration {
|
||||
Duration::from_millis(self.0)
|
||||
}
|
||||
|
||||
/// Returns `self` as a `u64` representing the elapsed time since the UNIX_EPOCH in
|
||||
/// milliseconds.
|
||||
pub const fn as_millis(&self) -> u64 {
|
||||
self.0
|
||||
}
|
||||
|
||||
/// Checked subtraction that returns `None` on an underflow.
|
||||
pub fn checked_sub(self, other: Self) -> Option<Self> {
|
||||
self.0.checked_sub(other.0).map(Self)
|
||||
|
||||
Reference in new issue
Block a user