Io l'avevo interpretato come: "se non riesci ad eseguire la funzione timestamp allora dai messaggio d'errore"
Ora provo ad inserirlo nel mio codice, vediamo che combina.
Che vuol dire che lui
esegue la funzione timestamp e controlla che non dia errore.
Ma la funzione la esegue e il timestamp lo scrive.
Per quanto riguarda <<, è un operatore di flusso.
cout è definito come seriale.
il comando:
DateTime now = RTC.now();
cout << now << endl;
corrisponde a:
DateTime now = RTC.now();
serial.print(now);
serial.println();
mentre
cout << endl << pstr("FreeRam: ") << FreeRam() << endl;
è
serial.print("FreeRam: ");
serial.print(FreeRam());
serial.println();
mentre bout è definito come una stringa (più o meno)
// format header in buffer
obufstream bout(buf, sizeof(buf));
bout << pstr("millis");
#if USE_DS1307
bout << pstr(",date,time");
#endif // USE_DS1307
for (uint8_t i = 0; i < SENSOR_COUNT; i++) {
bout << pstr(",sens") << int(i);
}
logfile << buf << endl;
questo diventerebbe:
buf =+ "millis";
#if USE_DS1307
buf =+ ",date,time";
#endif // USE_DS1307
for (uint8_t i = 0; i < SENSOR_COUNT; i++) {
buf =+ ",sens";
buf =+ int(i);
}
file.print(buf);
file.println();
Una cosa del genere.

Secondo me, l'operatore di flusso è molto intuitivo invece di scrivere un sacco di linee di codice per concatenare stringhe.
Guarda questo codice:
// format date/time
ostream& operator << (ostream& os, DateTime& dt) {
os << dt.year() << '/' << int(dt.month()) << '/' << int(dt.day()) << ',';
os << int(dt.hour()) << ':' << setfill('0') << setw(2) << int(dt.minute());
os << ':' << setw(2) << int(dt.second()) << setfill(' ');
return os;
}
Secondo te dentro lo "stream" os, cosa viene scritto?