rtc — Real Time Clock

The rtc module provides support for a Real Time Clock. It also backs the time.time() and time.localtime() functions using the onboard RTC if present.



Sets the rtc time source used by time.localtime(). The default is rtc.RTC().

Example usage:

import rtc
import time

class RTC(object):
    def datetime(self):
        return time.struct_time((2018, 3, 17, 21, 1, 47, 0, 0, 0))

r = RTC()