How to get milliseconds using timestamp in block?

chain returns now - 4611686020141944336 value. how convert timestamp to seconds and milliseconds?

I just did a test

println!("{}", spark.timestamp().await.unwrap().value);
     sleep(Duration::from_secs(1));
     println!("{}", spark.timestamp().await.unwrap().value);

in fact, the pause is 3-4 seconds and the output result is 4611686020141945438
4611686020141945442. - here the conclusion is that we can only operate in seconds

1 Like

Fuel uses tai64 instead of unix for our timestamps which is also already in seconds. Divide by 1000 to get milliseconds if you need to. Read more about tai64 here.

Example rust test below:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.