Created
August 26, 2018 15:59
-
-
Save mds1/9f41f9421752725df5c954a996cc7a11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get current block from ganache-cli | |
let block = await web3.eth.getBlock('latest'); | |
// Log initial timestamp -- logs 1535296387 | |
console.log(block.timestamp); | |
// Increase time by a huge amount simply to make it easier to distinguish | |
// between the logged 10-digit numbers (this changes leading digit from a | |
// 1 to a 2) | |
await increaseTime(533868440); | |
// Get the new block number (previous function also mines a block) | |
block = await web3.eth.getBlock('latest'); | |
// Log new timestamp from ganache-cli -- logs 2069164830 (this is updated) | |
console.log(block.timestamp); | |
// Log timestamp returned by the contract from a function that simply | |
// returns "now" -- logs 1535298108 (this is not updated) | |
console.log(String(await contract.getTime())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment