Some optimization in the check to when change the time.

Instead of calculating the time every second.
Change the day only when needed.
Change the minute only when needed.
Change the hour only when needed.