I'm looking at KittyBreeding.sol
and see
/// @dev Set the cooldownEndTime for the given Kitty, based on its current cooldownIndex.
/// Also increments the cooldownIndex (unless it has hit the cap).
/// @param _kitten A reference to the Kitty in storage which needs its timer started.
function _triggerCooldown(Kitty storage _kitten) internal {
// Compute the end of the cooldown time (based on current cooldownIndex)
_kitten.cooldownEndTime = uint64(now + cooldowns[_kitten.cooldownIndex]);
but I don't see where "now" is defined, except in their kitty-core.test.js
How does this DAPP track time, which lets the website show timers?
Best Answer
now
is a Solidity special variable, which equates to the current time since the epoch, in seconds.From the documentation (linked above):