I had a function which wasn't working in a test environment : I was doing something stupid and wanted to share, in case it catches other people out.
I was testing for an end time of an auction / crowdfunding opportunity / reward scheme against the Solidity property "now", which I was calling rather than sending a transaction. Because it's not necessary to be mining for the call to work, the now property was not being incremented, and was reflecting the timestamp of the last time that mining occurred on the test node, rather than the current time on the node.
So be careful using "block.timestamp" or "now" in "constant public" functions
Comments
It does not seem to be the timestamp of the block of the current transaction according to the behaviour I thought I saw - e.g. when I set up a contract state variable "endTIme" and then wait until it has passed, then send a transaction to a function which checks "now > contract.endTime", then switch on mining just to mine that transaction, the condition returns false. If I then send another transaction to the same function, the condition returns true.
James
http://james.carlyle.space
I hope this helps!
You can still count on it as being a time that has happened in the past for contract logic as long as your node has ntpd.