I try to specify uint type to uint16 instead of just doing uint or uint256 when dealing with time stamps but it says that I must use at least uint24. It works with uint24, but shouldn't uint16 be plenty enough?
Not really an answer to what you're asking, but...
Decreasing the size of a
uint to less that 256 bits will increase the associated gas costs, not decrease it like you might be expecting. It'll be best to leave it as a
Noting that timestamps are the number of seconds since the Unix epoch:
uint16maximum value = 65536 -> 01/01/1970 @ 6:12pm (UTC)
uint24maximum value = 16777216 -> 07/14/1970 @ 4:20am (UTC)
So these values are too small.
now) currently returns
1508618011, which is
0b1011001111010111010111100011011. This requires 31 bits. So you're looking at least at a
uint32, but more if you want to be future-proof.