def __init__(self, interval, callback, delay=0):
        """Synchronize the timer and start the trigger mechanism.
            Public properties:
            - start_time: reference startig time.time() in local time *on the interval* (synchro)
            - expected_time: theoritical time the trigger should happen as 'start_time + X * interval'
            - time_now: real time.time() when the trigger happened
        """
        self.version = "1.3.1 20130907"
        self.callback = callback
        self.interval = interval
        self.lock = threading.Lock()
        # wait for synchro on the next 'interval' sec
        now = time.gmtime() 
        while now.tm_sec % self.interval != 0:
            time.sleep(0.05)
            now = time.gmtime()
        # request a Timer   
        self.start_time = int(time.time() / self.interval) * self.interval + delay
        self.expected_time = self.start_time + self.interval
        self._timer = threading.Timer(self.expected_time - time.time(), self._ontimer)
        self._timer.start()
dataset/ETHPy150Open ericgibert/supersid/supersid/sidtimer.py/SidTimer.__init__/original