예제 #1
0
def randomize_timestamps(events, interval_duration):
    current_time = ztreamy.rfc3339_as_time(events[0].timestamp)
    time_max = current_time + interval_duration - 1
    exp_rate = 1.3 * len(events) / interval_duration
    for event in events:
        current_time += random.expovariate(exp_rate)
        timestamp = int(current_time)
        if timestamp > time_max:
            timestamp = time_max
        event.timestamp = ztreamy.get_timestamp(date=timestamp)
예제 #2
0
def randomize_timestamps(events, interval_duration):
    current_time = ztreamy.rfc3339_as_time(events[0].timestamp)
    time_max = current_time + interval_duration - 1
    exp_rate = 1.3 * len(events) / interval_duration
    for event in events:
        current_time += random.expovariate(exp_rate)
        timestamp = int(current_time)
        if timestamp > time_max:
            timestamp = time_max
        event.timestamp = ztreamy.get_timestamp(date=timestamp)
예제 #3
0
파일: events.py 프로젝트: jvrplmlmn/ztreamy
    def time(self):
        """Returns the event timestamp as a seconds since the epoch value.

        Note that the timezone information from the timestamp is
        lost. Returns None if the event has no timestamp set.

        """
        if self.timestamp is not None:
            return ztreamy.rfc3339_as_time(self.timestamp)
        else:
            return None
예제 #4
0
파일: events.py 프로젝트: jvrplmlmn/ztreamy
    def time(self):
        """Returns the event timestamp as a seconds since the epoch value.

        Note that the timezone information from the timestamp is
        lost. Returns None if the event has no timestamp set.

        """
        if self.timestamp is not None:
            return ztreamy.rfc3339_as_time(self.timestamp)
        else:
            return None