Arduino Clock

Hi Guys, this is my first post and help would be much appreciated.

Is there anyway of telling Arduino to do a particular process for a specified amount of time, e.g 20 seconds? I'm using a heart rate monitor that sends a value of 1 to Arduino for every heart beat. I want to be able to add the heart beats together for about 20 seconds so I can multiply that value by 3 to calculate a average beats per minute. All that springs to mind is the delay() method but I don't think that would work in this case. Any help would be great. Thanks,

Tom

You can check the millis() call after each heartbeat until you get around 20 seconds from your start time.

Cheers for the help.

Tom