check frequency by pressing button

hello people
I wish that when a button was pressed in a 3-second interval the program to continue to do what he's doing, if he were not in a tight range of 3 seconds it does something else.

Pressed once, after first checking if it was pressed again at an interval of 3 seconds, doing this until he ceases to be pressed in a 3-second interval.

something like this

int f = 1;  // f = function to execute
void setup()
{
  Serial.begin(9600);
  unsigned long start = millis();
  f = 1;
}

void loop()
{
  // CHECK BUTTON
  if (digitalRead(button) == HIGH && millis() - start < 3000UL)
  {
    start = millis();  // fast enough => restart timeout
    f = 1;
  }
  else 
  {
    f = 2; // too late :(
  }
  
  if (f == 1) f1();
  else f2();
}

void f1()
{
  Serial.print('1');
}

void f2()
{
  Serial.print('2');
}