How to display time on serial monitor (problems with time library)

Hey guys, I'm having a lot of problems with the time library. The only thing I want to do is to display the time on my serial monitor. Nothing fancy, just Hour:Minutes:Seconds. I would really appreciate if someone could help me with that cause I'm so confused on how to set the time and as to which functions I have to use. Thanks in advance.

Are you using an external timekeeping chip (for example, a DS3231)? If not, then you will lose the time whenever you lose power or reset the program.

Personally, I prefer not to use the Time library. Also, for what you're doing, I think the Time library is more complicated than what you need.

I suggest you use something like this:

// this part goes in your "setup"
byte hh=0; byte mi=0; byte ss=0; // hours, minutes, seconds
unsigned int dddd=0; // days (for if you want a calendar)
unsigned long lastTick=0; // time that the clock last "ticked"
char timestring[17]; // for output

// this part goes in your "loop"
if ((micros() - lastTick) >= 1000000UL) {
  lastTick += 1000000UL;
  if (ss>=60) { ss-=60; mi++; }
  if (mi>=60) { mi-=60; hh++; }
  if (hh>=24) { hh-=24; dddd++; }

// To display the time in the serial monitor:
sprintf(timestring,"%02d:%02d:%02d", hh, mi, ss);

I’ve had good success with both the DS1302 and DS1307, both really easy to use. The DS1307 is I2C and dead simple.

I used both of those chips on breadboard with a loose crystal, but that’s a pain in the ass so I just got a DS1307 on a breakout with a coin cell mounted on the other side.

If you need good timing, it’s well worth having a look at those options.

Check my Arduino website here with the date and time from the DS1307.

"94247924 milliseconds since Arduino power up or reset" What happens when it rolls over?

It's cool that you have a thermometer on there, though. Does it show outdoor or indoor temperature? You could have the Arduino report high and low temperature of the day, or since last reset.

odometer: "94247924 milliseconds since Arduino power up or reset" What happens when it rolls over?

Nothing. Millis is just a value- after 50 days when it rolls over, it's still a value, back at the start is all. I actually put that in to check if it was working before I added the RTC, like a pulse- I don't do anything with it.

Does it show outdoor or indoor temperature?

Right now it's a bit of a meaningless figure, since the Uno's sitting on top of my wife's desktop PC case and the sensor's hanging down the side. The PC covers are off (don't ask....) so the sensor if almost certainly influenced by the heat of the PC. But it's PoC more than anything else.