Simple Code Help

Hey,
I'm having problems writing code. I want to check a condition for a period of time, and if it is met during that time, then do one condition. And if after that period of time the condition is not met, it is to continue with the program code.

I know it's simple, but I can't quite piece it together.

Thanks.

Post what code you have (or what you think should work - even if it doesn't), and you might get a better response...

Thanks, I haven't got any code up and running yet, but for all i know we use the 'do while' function.

I think it should be something like this:

...
void(* resetFunction) (void) = 0;
...
do
{
    if(digitalRead(sensor) == HIGH
          {
          digitalWrite(buzzer, HIGH);
          delay(5000);
          digitalWrite(buzzer, LOW);
          resetFunction();
          {
}
while
(Somehow have a time function);
...
(Then continue with code...)