mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 18:11:10 +00:00
Aura and Slots refactoring (#8386)
* Make slot duration being exposed as `Duration` to the outside * Some slot info love * Add `build_aura_worker` utility function * Copy copy copy
This commit is contained in:
@@ -23,6 +23,7 @@ use codec::{Encode, Decode};
|
||||
#[cfg(feature = "std")]
|
||||
use sp_inherents::ProvideInherentData;
|
||||
use sp_inherents::{InherentIdentifier, IsFatalError, InherentData};
|
||||
use sp_std::time::Duration;
|
||||
|
||||
use sp_runtime::RuntimeString;
|
||||
|
||||
@@ -43,6 +44,11 @@ impl Timestamp {
|
||||
pub const fn new(inner: u64) -> Self {
|
||||
Self(inner)
|
||||
}
|
||||
|
||||
/// Returns `self` as [`Duration`].
|
||||
pub fn as_duration(&self) -> Duration {
|
||||
Duration::from_millis(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_std::ops::Deref for Timestamp {
|
||||
@@ -100,8 +106,8 @@ impl From<Timestamp> for u64 {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<sp_std::time::Duration> for Timestamp {
|
||||
fn from(duration: sp_std::time::Duration) -> Self {
|
||||
impl From<Duration> for Timestamp {
|
||||
fn from(duration: Duration) -> Self {
|
||||
Timestamp(duration.as_millis() as u64)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user