Creating a Timer/stopwatch with an LCD

I'm having trouble writing code to create a stopwatch/timer. I'm using an Arduino Mega board and a 20x4 LCD screen. This timer is only one portion of the data I'll be displaying. Below is the code I've written do calculate the time:

int getE_minutes() {
  double Emin;
  int curTime = millis();
  Emin = floor((curTime - pumpStartTime)/60000);
  Serial.print("Minutes: ");
  return Emin;

int getE_seconds(int Emin) {
  int curTime = millis();
  double sec = (curTime - pumpStartTime)/1000;
  int Esec = floor(sec - (60*Emin));
  Serial.print("Seconds: ");
  return Esec;

I've written them as functions so that I can call it whenever I need to and not have them taking up time processing when I don't need it (my LCD will have multiple screens, so I only need it to be calculated when the LCD is in that particular state).

I've gotten it to display, and using this code results in the seconds counting up from 0 to 32 and then suddenly switching from 32 to -32 and counting up to 0 and starting over again. The minutes just display 0.

Any suggestions? Thanks for your help!

32 - big clue. You're using "int"s to count milliseconds, and an "int" can store the range -32768 to + 32767

(I confess, I didn't read your code)

Thanks. I can't believe I didn't remember that... That was my problem. I'm using longs now instead of ints

If you look at the documentation for the millis function, you will see that the correct type (the return type for the millis() function) is unsigned long, not long.