The sprintf() function is very powerful, but rarely does an app use all of that power. In the code below, the sprintf() version uses 3450 bytes while the non-sprintf() version uses 2136 bytes.
char buffer[50];
unsigned long tempo = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop(void) {
tempo = millis();
//sprintf( buffer , "%01d:%02ld.%02ld", tempo / 60000L , tempo / 1000L % 60L, tempo % 1000L / 10L);
//Serial.println(buffer);
Serial.print(ltoa(tempo / 60000L, buffer, 10));
Serial.print(":");
Serial.print(ltoa(tempo / 1000L % 60L, buffer, 10));
Serial.print(".");
Serial.println(ltoa(tempo % 1000L / 10L, buffer, 10));
}
While the savings makes no difference in this test, if you find yourself up against memory limits down the road, try the simpler functions.