DS1302 RTC acting weird

I suggest to use a standard I2C RTC module like the DS1307 or (much better) DS3231.

These are readily available and are what most people use, so there is much more help available if you run into trouble.