Timer doing weird things, help

The problem is when i use 8000 (which equals 8 seconds here) it works completely fine and jumps out the loop, HOWEVER, when i use 8022 the loop goes on forever? how do i fix this problem?

Y is the what is calculated above^^ so if y is 8000, 9000,5000 etc it works but if its 8022 it doesnt.

i have used all the data types for the variables but still doesnt work.

interval_one = y; //where y is calculated

if(flag==0){
time_since_last_reset = millis();
while((millis() - time_since_last_reset) < (interval_one) ){

setMaxTorque (0,1023);
setEndless (0, ON);
turn (0, LEFT, 1000); //LEFT = springs down , RIGHT = springs up

}
setMaxTorque (0,1023);
setEndless (0, OFF);
turn (0, LEFT, 1000);
flag = 1;
}

Cheers,

Mark

POST ALL YOUR CODE.

In code tags, this time.

my code is way to large to post here, the rest of the code wont help

You mean the rest of the code with all the datatypes of the variables won't help us?

the rest of the code does not interact with that section otherwise i would of included it, why are you mad

What is the value of interval_one?
(Note: the snippet above was edited by the original time-waster AFTER I posted this question)

khordi:
my code is way to large to post here

Attach it.

khordi:
the rest of the code wont help

More code is the only way any of us can help you.

(deleted)

Please read the guides on the first page for help in posting. The code you have posted makes no sense, it is incomplete and shows no reference to the 8000 or the 8022.

One might say that 8000 and/or 8022 won't work because they are both declared as bytes and are larger than 255, but who knows?