Steve has already mentioned the DS1307

As your request for a code example was your very first post, you should start HERE

if you don't want to use an RTC, and had searched the Forum you would have ended up THERE

There are many other RTC examples, do some searching...