timing way off on simple sketch

I am sorry , I was not aware that posting code like that was wrong. I posted last night and went to bed, this morning it must be too late to edit as I can't find an edit option.

Thanks for pointing that out. It won't happen again. My apologies to the forum, my apologies to everyone on this thread.

it must be too late to edit as I can't find an edit option.

In any of your posts, there is an option to edit the post.

I had to click post to get the rest of this correct. Under the text area, there is Quick Edit (don't pick that one) and More... with a down arrow. Click that arrow, and select Modify.

Then, highlight your code and select the code icon (the leftmost icon on the top row).

Thanks PaulS. Just now gulping down my first cup of coffee....don't ask how I did not see the edit option...IDK, mostly thinking about the long day ahead of me...But it's done-I appreciate that!

 return m*60000;  //converts minutes to milliseconds

60000 is a literal. The compiler will assume that it is an int, since there are no directives to the contrary. m is an int. You will have a very hard time holding the result of multiplying an int by an int in an int register, when one of the values overflows the int register by itself. The only value for m that will not result in an overflow is 0.

Make the compiler understand that 60000 is an unsigned long by using UL as the suffix.

Do the same thing with any other literals that could possibly result in overflow, especially where the result is going to be stored in a non-int type.

With the functions working properly, the rest of your code should work, too. What (else) is the problem?

PaulS:

 return m*60000;  //converts minutes to milliseconds

60000 is a literal. The compiler will assume that it is an int, since there are no directives to the contrary.

No. 60000 is too big for int, so it will be long. (on AVR)