Use the time.h library with the rtc.
You're probably getting glitches because you're polling the rtc multiple times within a second.
Use the time.h library with the rtc.
You're probably getting glitches because you're polling the rtc multiple times within a second.