Created
August 25, 2015 22:51
-
-
Save linagee/28693697e1deed6507ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract mortal { | |
/* Define variable owner of the type address*/ | |
address owner; | |
/* this function is executed at initialization and sets the owner of the contract */ | |
function mortal() { owner = msg.sender; } | |
/* Function to recover the funds on the contract */ | |
function kill() { if (msg.sender == owner) suicide(owner); } | |
} | |
contract TimeClock is mortal { | |
struct TimeEntry { | |
uint start; | |
uint stop; | |
} | |
struct TimeUser { | |
TimeEntry[] timeEntries; | |
} | |
mapping (address => TimeUser) timeUsers; | |
function startTime() { | |
var arr = timeUsers[msg.sender]; | |
arr.timeEntries.length++; //add an entry | |
arr.timeEntries[arr.timeEntries.length].start = block.timestamp - 15; | |
} | |
function getStartTime() returns (uint time) { | |
var arr = timeUsers[msg.sender]; | |
return arr.timeEntries[arr.timeEntries.length].start; | |
} | |
//stop => for msg.sender, also must enter a "note" that gets stored (must check this is valid with state) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment