The problem I am having is managing to utilize <time.h> function difftime to allow a button to be pressed until 2 seconds have passed, then displaying a new button for another 2 seconds etc...
I currently use difftime to manage the total time buttons are displayed on the screen to 60 seconds.

Difftime measures in seconds, 2 values Start and End and returns their difference.

Here is what I have so far...

Code:
//other parts of the struct irrelevant to my problem
bool button_pushed;
	
void Board::wait_for_button()
{
	while (!button_pushed) Fl::wait();
	button_pushed = false;	
}

int main()
{
        time_t start,end;
	int dif, total_time=0;

	while (total_time<=10)	  //determines how long game lasts
	{

		int which_mole = randint(4);

		if (which_mole == 0)
		{
			time(&start);		//start timer
			x.mole0.label = points();
			x.mole0.show();
			x.circle0.set_radius(50);
			x.circle0.set_color(randint(256));
			x.wait_for_button();		//button pressed
			time(&end);			//end timer
			dif = difftime(end,start);
			total_time+=dif;	//add time elapsed to total time
			dif = 0;		//reset time elapsed
		}

		if (which_mole == 1)
		{
			time(&start);
			x.mole1.label = points();
			x.mole1.show();
			x.circle1.set_radius(50);
			x.circle1.set_color(randint(256));
			x.wait_for_button();
			time(&end);
			dif = difftime(end,start);
			total_time+=dif;
			dif = 0;
		}

		if (which_mole == 2)
		{
			time(&start);
			x.mole2.label = points();
			x.mole2.show();
			x.circle2.set_radius(50);
			x.circle2.set_color(randint(256));
			x.wait_for_button();
			time(&end);
			dif = difftime(end,start);
			total_time+=dif;
			dif = 0;
		}

		if (which_mole == 3)
		{
			time(&start);
			x.mole3.label = points();
			x.mole3.show();
			x.circle3.set_radius(50);
			x.circle3.set_color(randint(256));
			x.wait_for_button();
			time(&end);
			dif = difftime(end,start);
			total_time+=dif;
			dif = 0;
		}
	}
}
Some things I have tried to do, and have failed at is wrapping each if statement in a do-while loop, with the while condition being dif<=2. When I used this, the button stayed in place (not utilizing the random button-position variable "which-mole").

Im not sure if i have provided enough of the program to get help on it, but the program is quite large so opted to choose what I felt were the relevant parts.