def tick(self, time_step=None):
        """
        Provide a new time tick and return the current frequency
        """
        if time_step is None:
            time_step = time.time()

        self.tick_times.append(time_step)

        # only consider the ticks in the most recent time_window
        while time_step - self.tick_times[0] > self.time_window:
            del self.tick_times[0]
            
        if len(self.tick_times)<2:
            return 0

        return (len(self.tick_times)-1)/(time_step-self.tick_times[0])

        Provide a new time tick and return the current frequency
        
recipes/Python/576607_Frequency_measurement_convenience/recipe-576607.py