4

When I call function giveTime, is the time stamp "now" from the block where my call is mined or from the previous block?

contract Time {
  uint time;

  function giveTime() {
    time=now;
  }

  function Timestamp() constant returns (uint block_time) {
    block_time=time;
  }
}
5

It's the timestamp of the current block.

The idea is like this: When a miner mines a block, he/she picks the timestamp, executes all contracts with the chosen timestamp to update the state, and does the searching. Thus, now is the timestamp of the current block.

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.