Skip to content

Commit

Permalink
Fix no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez committed Jun 23, 2023
1 parent 720bfbc commit b79be58
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sdk/src/types/block/payload/transaction/essence/regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ impl RegularTransactionEssenceBuilder {

verify_payload::<true>(&self.payload)?;

#[cfg(feature = "std")]
let creation_time = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.expect("Time went backwards")
.as_nanos() as u64;
// TODO no_std way to have a nanosecond timestamp
#[cfg(not(feature = "std"))]
let creation_time = 0;

Ok(RegularTransactionEssence {
network_id: self.network_id,
Expand Down Expand Up @@ -129,10 +133,14 @@ impl RegularTransactionEssenceBuilder {

verify_payload::<true>(&self.payload)?;

#[cfg(feature = "std")]
let creation_time = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.expect("Time went backwards")
.as_nanos() as u64;
// TODO no_std way to have a nanosecond timestamp
#[cfg(not(feature = "std"))]
let creation_time = 0;

Ok(RegularTransactionEssence {
network_id: self.network_id,
Expand Down

0 comments on commit b79be58

Please sign in to comment.