bbc325e Make sure the SMA window has really at least 2 seconds

Authored and Committed by praiskup 2 years ago
    Make sure the SMA window has really at least 2 seconds
    
    This could cause problems on very unstable connections.  When next()
    wasn't called for a long time, and then it was called very frequently
    (so time() returned 4x the same value) we were clean()ing the
    window.dequeue so much so we got "last" equal to "deque[0][0]",
    therefore counter/(last - deque[0][0]) could cause a division by zero.
    
    In theory, this would also solve some temporary situations when
    subsequent calls to time() did not return consecutive values:
    
        >>> a = time() ; b = time() ; a > b
        True
    
    Resolves: rhbz#2103093
    Version: 1.6-4
    
        
file modified
+4 -1