Calculate the total duration of the stream in seconds.
(self)
| 418 | self.events.append(event_data) |
| 419 | |
| 420 | def get_duration(self): |
| 421 | """Calculate the total duration of the stream in seconds.""" |
| 422 | if self.first_event_time is None or self.last_event_time is None: |
| 423 | return 0 |
| 424 | return (self.last_event_time - self.first_event_time).total_seconds() |
| 425 | |
| 426 | def summarize(self): |
| 427 | """Print a summary of the stream statistics.""" |