mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
consensus-slots: cleanup SlotDuration config (#10878)
* consensus-slots: cleanup the SlotDuration config * fix tests * address review comments
This commit is contained in:
@@ -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