thats a real real basic program, you can just do a loop to monitor the pin , as soon as pin goes high, change to second loop, use a pause and count, store variable, if you wanted to you could have another pin blink a led to display the seconds count wait a bit then repeat. you should be able to build the code from the manual or samples page using blink led program and loop sample.