MIllis , int not refresh value

Nothing in that code ever changes any variables except index and certainly never changes any of the elements of periods[]. That's why the values you get out of that array never change.

If you have some other code that does something useful perhaps you should post that.

Steve