7

How can I get the current time in Solidity. I don't need the current block's time given by now and block.timestamp, but rather the actual current time.

Thank you for your help!

1
  • you mean, current System time?
    – Gopal ojha
    Aug 2, 2017 at 0:03

2 Answers 2

23

Within the Ethereum Virtual Machine, there isn't a way to get the current time, other than the block time. So there is no way to get it in Solidity.

Why?

There is disagreement between computers about what the current time is, and Ethereum needs to run every transaction with exactly the same outcome on every node.

What next?

Outline what you're trying to accomplish and ask about that.

  • Are you trying to time how long a transaction takes? Run the node locally and time it
  • Are you trying to achieve sub-block precision of payments? Payment channels might be what you're looking for
  • Trying to display a verified time in a Dapp? Use the local time, bounded by block timestamp
  • etc. etc.
-2

or carver just dont't make everything as difficult as possible as with the entire web3 framework and just make a code to get the current_fing time. I mean mysql did it and it has worked great for databases whioch is all a blockchain is just an un editable one 'to a point' just saying

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 25 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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