Chess Clock Timing Bug

void sureTut() {
  int a = millis();//to scale the time without delays
  int basSira = sira;//to notice if player move and press button, then the other player's time will start reducing
  int s = 1000;//interval of a second
  delay(50);//minimum delay to block arduino thinking player pressed button for million times...
  while (sira == basSira){
    if(sira == 1) {//if turn is player 1's
      if(dakika1<0) {//detect when time is gone and reset clock
        dakika1 = 0;
        saniye1 = 0;
        sureGoster();
        lcd.write("Bitti");
        delay(5000);
        kurulum();
        return;
      }
      if((millis() - a) >= s) {//detect a second
        a = millis();//reset variable a
        saniye1--;//reduce second
        if (saniye1 < 1) {//detect if second goes under 1
          saniye1 = 59;//make second 59
          dakika1--;//reduce minutes
        }
      }
    } else { // same with other player
      if(dakika0<0) {
        dakika0 = 0;
        saniye1 = 0;
        sureGoster();
        lcd.write("Bitti");
        delay(5000);
        kurulum();
        return;
      }
      if((millis() - a) >= s) {
        a = millis();
        saniye0--;
        if (saniye0 < 1) {
          saniye0 = 59;
          dakika0--;
        }
      }
    }

    if(digitalRead(A0)){//to detect button pressed and the other player's turn
      sira = 1;
      saniye0 += modlarA[mod-1]; //To increase second by a chess rule for example: 5+5 means 5 minutes in start and then increase second by 5 when a player moved
      if(saniye0 >= 60) {//if increasing time is bigger than 60 and increase minute
        saniye0 -= 60;
        dakika0++;
      }
      sureTut();//restart function
      delay(100);
      return;//quit function
    }
      if (digitalRead(A2)) { //same
      sira = 0;
      saniye1 += modlarA[mod-1];
      if(saniye1 >= 60) {
        saniye1 -= 60;
        dakika1++;
      }
      sureTut();
      delay(100);
      return;
    }
    sureGoster();//to update 2x16 lcd
  }
}

I'm trying to make a chess clock but I can't solve this bug:
When time of any player reduces under 30 seconds the time is accelerating.
Thanks in advance!

This is just an excerpt, the error usually is in the part that people are hiding from us. Post complete code!

It would help if you name the variables in English, so we understand what's going on.

You are recursively calling this function:

      sureTut();//restart function

This is not restarting the function but calling it inside itself. This may lead to a stack overflow.

Complete code is too long and there is no any other code editing the timing variables, and if it would be a stack overflow the arduino must reset itself because low ram.

  int a = millis();//to scale the time without delays

It's usually a good idea to understand what kind of value a function returns. The millis() function does not return an int.

True, thanks for it, I didn't notice the Int can't store big values, the limit is 32768 I think, becaus it's nearly 30 seconds and It's a power of 2

Your a variable should hold the time you're timing from. It shouldn't get a new value from millis on each turn of loop. It should retain the value you gave it in the timing code. Make it static or global.

isalih:
Complete code is too long and there is no any other code editing the timing variables, and if it would be a stack overflow the arduino must reset itself because low ram.

No. If there is a stack overflow, something will happen which is usually NOT a reset. The behavior is not defined.

I think the int limitation is probably the cause of your problem.