A (signed) 64 bit timestamp can store a date much larger than the age of the universe.

On many platforms this would be a micro-optimization, but in the context of Ethereum, we want to squeeze every drop of gas out, don't we?

  • My mistake in the title. A uint is 256 bits, not bytes.
    – Joseph
    Aug 26 '18 at 8:26

A storage slot is 256 bits, as are hashes, ETH amounts etc, so it's simpler to standardize on returning a 256-bit number.

However, if you need a timestamp in your contract you are under no obligation to store 256 bits: It's simple to cast it to a smaller size. This will often provide a gas saving if you're storing other small pieces of data at the same time.

  • Also the EVM is 256 bits machine operating data of size other from 256 bits requires extra steps.
    – Ismael
    Aug 28 '18 at 17:27

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.