3

In EOS contract library, it supports the now() and current_time()method to get the current time, but it only represent the block time and won't be changed during the execution.

But now I want to print the real time in the contract console, because my contract cost too much cpu, I want to figure it out which code takes so much time, is there any method?

1 Answer 1

2

In EOS contract library, it supports the now() and current_time()method to get the current time, but it only represent the block time and won't be changed during the execution.

Yes, because contracts need to be deterministic and output the same result for anyone who replays the blockchain at any point in the future. If it showed the current time, it would show different output for different BPs and full nodes, and consensus could not be reached. Therefore, I don't think you can print the real time in an EOSIO contract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.