import time

class RealtimeInterval:
    startTime = 0
    interval = 0

    def __init__(self, intervalInSeconds):
        self.startTime = time.time()
        self.interval = intervalInSeconds

    def start(self):
        self.startTime = time.time()
        
    def hasElapsed(self):
        timeNow = time.time()
        if self.startTime == 0:
            self.startTime = timeNow
            return False
    
        elapsed = timeNow - self.startTime
        if (elapsed >= self.interval):
            self.startTime = timeNow;
            return True

import time

class RealtimeInterval:
    def __init__(self, intervalInSeconds, allowImmediate = True):
        self.interval = intervalInSeconds
        self.allowImmediate = allowImmediate
        self.reset()

    def reset(self):
        if self.allowImmediate:
            self.startTime = 0
        else:
            self.startTime = time.time()
        
    def hasElapsed(self):
        timeNow = time.time()
        elapsed = timeNow - self.startTime
        if (elapsed >= self.interval):
            self.startTime = timeNow;
            return True

Improve real time throttle so that it can start immediate the first time.
Improve real time throttle so that it can start immediate the first time.
