This seems so basic to have some sort of run time clock on an arduino device. Why is this so difficult?
Because you mess around. Back to your original code sample, when applying the hint you got about the Time library, you might get something like this:
sprintf(tweet,"%2.2d:%2.2d:%2.2d Sensor Reading S1=%e S2=%e",
hour(), minute(), second(),
And don't forget to include the Time library at the top of your sketch with this:
Does that look like a start? If you want to have time match the real time closer, you can set it anywhere in your program with:
This leaves only the small detail of getting good values for the variables hr, min, sec, day, month and yr. This can be achieved in various ways, but that we can leave for later. For experimenting you always can put that line in your setup() function: