@@ -9,7 +9,7 @@ use init4_bin_base::{
9
9
} ;
10
10
use signet_sim:: { BlockBuild , BuiltBlock , SimCache } ;
11
11
use signet_types:: constants:: SignetSystemConstants ;
12
- use std:: time:: { Duration , Instant , SystemTime , UNIX_EPOCH } ;
12
+ use std:: time:: { Duration , Instant } ;
13
13
use tokio:: {
14
14
sync:: {
15
15
mpsc:: { self } ,
@@ -94,7 +94,7 @@ impl Simulator {
94
94
) -> eyre:: Result < BuiltBlock > {
95
95
debug ! (
96
96
block_number = block_env. number,
97
- deadline = ? self . instant_to_timestamp ( finish_by) ,
97
+ ? finish_by,
98
98
tx_count= sim_items. len( ) ,
99
99
"starting block build" ,
100
100
) ;
@@ -208,14 +208,11 @@ impl Simulator {
208
208
// We add a 1500 ms buffer to account for sequencer stopping signing.
209
209
let deadline =
210
210
Instant :: now ( ) + Duration :: from_secs ( remaining) - Duration :: from_millis ( 1500 ) ;
211
- trace ! ( deadline = ? self . instant_to_timestamp ( deadline) , "calculated deadline for block simulation" ) ;
211
+ trace ! ( ? deadline, "calculated deadline for block simulation" ) ;
212
212
213
213
let buffered_deadline = deadline. max ( Instant :: now ( ) ) ;
214
214
trace ! ( ?buffered_deadline, "final deadline for block simulation" ) ;
215
215
216
- let timestamp = self . instant_to_timestamp ( buffered_deadline) ;
217
- trace ! ( ?timestamp, "deadline converted to timestamp" ) ;
218
-
219
216
buffered_deadline
220
217
}
221
218
@@ -245,23 +242,4 @@ impl Simulator {
245
242
let wrapped_db: AlloyDatabaseProvider = WrapDatabaseAsync :: new ( alloy_db) . unwrap ( ) ;
246
243
Some ( wrapped_db)
247
244
}
248
-
249
- /// Converts an `Instant` to a UNIX timestamp in seconds and milliseconds.
250
- pub fn instant_to_timestamp ( & self , instant : Instant ) -> ( u64 , u128 ) {
251
- let now_instant = Instant :: now ( ) ;
252
- let now_system = SystemTime :: now ( ) ;
253
-
254
- let duration_from_now = now_instant. duration_since ( instant) ;
255
-
256
- // Subtract that duration from the system time
257
- let target_system_time = now_system - duration_from_now;
258
-
259
- let duration_since_epoch =
260
- target_system_time. duration_since ( UNIX_EPOCH ) . expect ( "Time went backwards" ) ;
261
-
262
- let seconds = duration_since_epoch. as_secs ( ) ;
263
- let milliseconds = duration_since_epoch. as_millis ( ) ;
264
-
265
- ( seconds, milliseconds)
266
- }
267
245
}
0 commit comments