I’d rather do none of these /1000
conversions and just return raw value and leaving the conversion to caller.
function clock() returns (uint) {
return block.timestamp;
}
In addition, from a standardization scoping perspective, I think the representation of time shall be solved in a separate EIP, something like
EIP-XXX Time Scheme
Specification
enum TimeSchemeOption {
blocknum = 0;
timestamp = 1;
};
interface ERCTimeScheme {
function defaultTimeScheme() external pure returns(TimeSchemeOption);
}
Ref Impl
contract Foo is ERCTimeScheme, ERC1202, ERC5805, ERC5732 {
function defaultTimeScheme() external pure returns(TimeSchemeOption) {
return TimeSchemeOption.blocknum;
}
}
This help ensuring whenever a time is being used, the scheme is acquirable and shall be consistent across different functions.
Complying contracts of EIP-1202 probably need to align with the same sense of time too. The EIP-5007: Time NFT, EIP-721 Time Extension however choose to use int64 for unix stamp.
(posted as EIP-XXX Time Scheme to see if there is interest to consolidate)