Timeline for How does time in the blockchain work?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 22, 2017 at 20:50 | comment | added | Ismael♦ |
In my example startTime[msg.sender] is the time where the watch has started, ie the user first request to the contract. Then startTime[msg.sender] + 60 minutes is 1 hour after the first request. In that case if now <= startTime[msg.sender] + 60 minutes is true, it implies that less than an hour has elapsed.
|
|
Jul 22, 2017 at 19:06 | vote | accept | ACluelessProgramer | ||
Jul 22, 2017 at 11:44 | comment | added | ACluelessProgramer |
Actually, wouldn't be if (now <= startTime[msg.sender] + 60 minutes) with an less than equal to operator? So we can check as long as now is less or equal to now + 60 minutes?
|
|
Jul 22, 2017 at 11:34 | comment | added | ACluelessProgramer |
This is what I have been trying to do! Let me make sure I have this right: you are mapping the msg.sender to the current block (a uint), then checking to see if the current block is more than or equal to the msg.sender 's time of transaction + 60 minutes, and finally doing whatever you need to do in the if function.
|
|
Jul 22, 2017 at 2:31 | history | edited | Ismael♦ | CC BY-SA 3.0 |
explain what block.timestamp is.
|
Jul 22, 2017 at 2:21 | history | answered | Ismael♦ | CC BY-SA 3.0 |