lcd.printIn(".") // print decimal point
int fractional = elapsedTime % 1000L; // use modulo operator to get fractional part of time
lcd.printIn(fractional); // print fractional part of time
I don’t think this will work quite right unless printIn is smart enough to print the right number of leading zeroes. For example, lets say elapsed time is 1001. In that case, secs = 1001 / 1000 = 1, and fractional = 1001 % 1000 = 1.
I think your code will print this as 1.1 rather than 1.001, but then again I’m not really familiar with the 4-bit LCD library, so I could be wrong.
Also, from an optimization standpoint, you could probably speed things up significantly by replacing the modulus calculation with multiplication and subtraction. I could be wrong about this, but my guess is that (long) % (long) is a fairly complicated calculation (since I know division involving longs is incredibly complicated and hence slow).
int secs = elapsedTime / 1000L; // this is slow but we have to do it
int fractional = elapsedTime - secs * 1000L; // I THINK this is much faster than elapsedTime % 1000L
// do something here to figure out how many leading zeroes to first print, eg:
if (fractional < 100)
else if (fractional < 10)