Explain solidity>timestamps

Working with Time

Smart contracts can access the current time using block.timestamp.

What is block.timestamp?

block.timestamp returns the current Unix timestamp (seconds since Jan 1, 1970).

It's set by the miner when they create the block.



Casting to uint64:

block.timestamp returns a uint256, but we use uint64 for storage efficiency.

Cast it like this: uint64(block.timestamp)



Setting Deadlines:

In startGame, set the accept deadline:

acceptDeadline = uint64(block.timestamp) + ACCEPT_TIMEOUT;

In makeMove, update the last move time:

lastMoveAt = uint64(block.timestamp);



Add timestamp tracking to startGame and makeMove.

Add timestamp tracking
0%
Requirements:
Sets acceptDeadline in startGame
Uses block.timestamp for acceptDeadline
Casts timestamp to uint64
Adds ACCEPT_TIMEOUT to deadline
Sets lastMoveAt in makeMove
lastMoveAt uses block.timestamp
lastMoveAt casts to uint64