Against my better judgement.....
First, I suggest using a DS3231 module instead of the DS-1302 module or DS-1307 modules. The accuracy of the DS3231 is much better than the DS-1302 or DS-1307. There is a DS-1307 Swordfish include module, which I have very slightly modified for the DS3231. There isn't a DS-1302 include module, so I suggest forgetting about the DS1302.
Next point - The DS3231, as are almost all RTC modules, uses the I2C interface. I2C interfaces are complex, and must be done in the correct way; there is ZERO room for random changes.
There are many steps to making a clock. You need a mechanism to set the time and date. You have to read separate registers for hours, minutes and seconds and then do the math to display the results. My code is going to take more explanation than I am willing to provide, with much of it dedicated to the display, which won't apply to what you're doing.
I've attached the DS3231 include module. I suggest downloading the DS3231 datasheet and taking a look at the task you're trying to do.