Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit b80bd52

Browse files
committed
Remove time-utils
1 parent 9faa823 commit b80bd52

File tree

13 files changed

+12
-105
lines changed

13 files changed

+12
-105
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ Caching, Importing Blocks, and Block Information
318318
journaldb keccak-hasher len-caching-lock macros memory-cache memzero
319319
migration-rocksdb ethcore-network ethcore-network-devp2p panic_hook
320320
patricia-trie-ethereum registrar rlp_compress rlp_derive parity-runtime stats
321-
time-utils triehash-ethereum unexpected parity-version
321+
triehash-ethereum unexpected parity-version
322322
```
323323

324324
</p></details>

ethcore/engines/authority-round/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ parity-bytes = "0.1"
3131
parking_lot = "0.9"
3232
rand = "0.7"
3333
rlp = "0.4.0"
34-
time-utils = { path = "../../../util/time-utils" }
3534
unexpected = { path = "../../../util/unexpected" }
3635
validator-set = { path = "../validator-set" }
3736

ethcore/engines/authority-round/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ use rlp::{encode, Decodable, DecoderError, Encodable, RlpStream, Rlp};
6262
use ethereum_types::{H256, H520, Address, U128, U256};
6363
use parity_bytes::Bytes;
6464
use parking_lot::{Mutex, RwLock};
65-
use time_utils::CheckedSystemTime;
6665
use common_types::{
6766
ancestry_action::AncestryAction,
6867
BlockNumber,
@@ -759,10 +758,10 @@ fn verify_timestamp(step: &Step, header_step: u64) -> Result<(), BlockError> {
759758
// Returning it further won't recover the sync process.
760759
trace!(target: "engine", "verify_timestamp: block too early");
761760

762-
let found = CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(oob.found))
761+
let found = UNIX_EPOCH.checked_add(Duration::from_secs(oob.found))
763762
.ok_or(BlockError::TimestampOverflow)?;
764-
let max = oob.max.and_then(|m| CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(m)));
765-
let min = oob.min.and_then(|m| CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(m)));
763+
let max = oob.max.and_then(|m| UNIX_EPOCH.checked_add(Duration::from_secs(m)));
764+
let min = oob.min.and_then(|m| UNIX_EPOCH.checked_add(Duration::from_secs(m)));
766765

767766
let new_oob = OutOfBounds { min, max, found };
768767

ethcore/engines/clique/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ macros = { path = "../../../util/macros" }
2222
rand = "0.7"
2323
parking_lot = "0.9"
2424
rlp = "0.4.0"
25-
time-utils = { path = "../../../util/time-utils" }
2625
unexpected = { path = "../../../util/unexpected" }
2726

2827
[dev-dependencies]

ethcore/engines/clique/src/block_state.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use common_types::{
2828
use ethereum_types::{Address, H64};
2929
use log::{debug, trace};
3030
use rand::Rng;
31-
use time_utils::CheckedSystemTime;
3231
use unexpected::Mismatch;
3332

3433
use crate::{
@@ -273,7 +272,7 @@ impl CliqueBlockState {
273272
// This is a quite bad API because we must mutate both variables even when already `inturn` fails
274273
// That's why we can't return early and must have the `if-else` in the end
275274
pub fn calc_next_timestamp(&mut self, timestamp: u64, period: u64) -> Result<(), Error> {
276-
let inturn = CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(timestamp.saturating_add(period)));
275+
let inturn = UNIX_EPOCH.checked_add(Duration::from_secs(timestamp.saturating_add(period)));
277276

278277
self.next_timestamp_inturn = inturn;
279278

ethcore/engines/clique/src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ use macros::map;
8484
use parking_lot::RwLock;
8585
use rand::Rng;
8686
use unexpected::{Mismatch, OutOfBounds};
87-
use time_utils::CheckedSystemTime;
8887
use common_types::{
8988
BlockNumber,
9089
ids::BlockId,
@@ -571,7 +570,7 @@ impl Engine for Clique {
571570

572571
// Don't waste time checking blocks from the future
573572
{
574-
let limit = CheckedSystemTime::checked_add(SystemTime::now(), Duration::from_secs(self.period))
573+
let limit = SystemTime::now().checked_add(Duration::from_secs(self.period))
575574
.ok_or(BlockError::TimestampOverflow)?;
576575

577576
// This should succeed under the constraints that the system clock works
@@ -581,7 +580,7 @@ impl Engine for Clique {
581580

582581
let hdr = Duration::from_secs(header.timestamp());
583582
if hdr > limit_as_dur {
584-
let found = CheckedSystemTime::checked_add(UNIX_EPOCH, hdr).ok_or(BlockError::TimestampOverflow)?;
583+
let found = UNIX_EPOCH.checked_add(hdr).ok_or(BlockError::TimestampOverflow)?;
585584

586585
Err(BlockError::TemporarilyInvalid(OutOfBounds {
587586
min: None,
@@ -692,8 +691,8 @@ impl Engine for Clique {
692691
// Ensure that the block's timestamp isn't too close to it's parent
693692
let limit = parent.timestamp().saturating_add(self.period);
694693
if limit > header.timestamp() {
695-
let max = CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(header.timestamp()));
696-
let found = CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(limit))
694+
let max = UNIX_EPOCH.checked_add(Duration::from_secs(header.timestamp()));
695+
let found = UNIX_EPOCH.checked_add(Duration::from_secs(limit))
697696
.ok_or(BlockError::TimestampOverflow)?;
698697

699698
Err(BlockError::InvalidTimestamp(OutOfBounds {

ethcore/private-tx/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ serde_derive = "1.0"
4444
serde_json = "1.0"
4545
spec = { path = "../spec" }
4646
state-db = { path = "../state-db" }
47-
time-utils = { path = "../../util/time-utils" }
4847
tiny-keccak = "1.4"
4948
trace = { path = "../trace" }
5049
transaction-pool = "2.0.1"

ethcore/private-tx/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ extern crate derive_more;
7171
extern crate rlp_derive;
7272
extern crate vm;
7373

74-
#[cfg(not(time_checked_add))]
75-
extern crate time_utils;
76-
7774
#[cfg(test)]
7875
extern crate env_logger;
7976

ethcore/private-tx/src/log.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ use parking_lot::RwLock;
2626
use serde::ser::{Serializer, SerializeSeq};
2727
use error::Error;
2828

29-
#[cfg(not(time_checked_add))]
30-
use time_utils::CheckedSystemTime;
31-
3229
/// Maximum amount of stored private transaction logs.
3330
const MAX_JOURNAL_LEN: usize = 1000;
3431

@@ -331,9 +328,6 @@ mod tests {
331328
use parking_lot::RwLock;
332329
use super::{TransactionLog, Logging, PrivateTxStatus, LogsSerializer, ValidatorLog};
333330

334-
#[cfg(not(time_checked_add))]
335-
use time_utils::CheckedSystemTime;
336-
337331
struct StringLogSerializer {
338332
string_log: RwLock<String>,
339333
}

ethcore/verification/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ parity-bytes = "0.1.0"
2727
parity-util-mem = "0.3.0"
2828
parking_lot = "0.9"
2929
rlp = "0.4.2"
30-
time-utils = { path = "../../util/time-utils" }
3130
triehash = { package = "triehash-ethereum", version = "0.2", path = "../../util/triehash-ethereum" }
3231
unexpected = { path = "../../util/unexpected" }
3332

0 commit comments

Comments
 (0)