Files
github-oracle/contracts/lib/IntLib.sol
T

28 lines
590 B
Solidity

pragma solidity ^0.4.0;
library IntLib{
uint constant day = 60*60*24;
uint constant week = 60*60*24*7;
uint constant month = 60*60*24*30;
function uint2str(uint i) internal constant returns (string){
if (i == 0) return "0";
uint j = i;
uint len;
while (j != 0){
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
while (i != 0){
bstr[k--] = byte(48 + i % 10);
i /= 10;
}
return string(bstr);
}
}