To measure time

Hello everyone.. I need help how to write program for measuring time. In my case i want to make a program that start record time when the sensor detect object and stop the timer when the object left the sensor. I use ir module for the sensor..

get a RTC shield with a SD card slot

once you have your first event, data log the time and "HIGH" or "Detected" or some such

as for the 'not detected' condition, that will be a timed condition ?
if there has not been any movement is "X" seconds, then the condition becomes low.

then write to the SD card the time and "LOW"

there are lots of links that will walk you through this.
spend a few minutes reading about the RTC and SD card and data logging.

Do you need real time, or elapsed time? (If you don't need time-of-day you don't need an RTC module.)

How what is the (approximate) elapsed time?

How much precision/accuracy do you need?

The normal way of measuring elapsed time is to read [u]millis()[/u] into a Start variable, then into an End variable, and subtract.

what will be the least count of the timer.you can use internal timer in normal mode with maximum .0625 microsecond least count.if you donot wish this accuracy then you can go for inbuilt library.
i have done similar project for ballistic time measurement.