Skip to content

Commit

Permalink
BUGFIX: fix kbps calculation for generator when show_progress=True
Browse files Browse the repository at this point in the history
  • Loading branch information
medley56 committed Oct 9, 2024
1 parent 1873d9c commit 57bc14d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ list and release milestones.
## Version Release Notes
Release notes for the `space_packet_parser` library

### v5.1.0 (unreleased)
- BUGFIX: Fix kbps calculation in packet generator for showing progress.

### v5.0.1 (released)
- BUGFIX: Allow raw_value representation for enums with falsy raw values. Previously these defaulted to the enum label.

Expand Down
2 changes: 1 addition & 1 deletion space_packet_parser/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def _print_progress(
# Fast calls initially on Windows can result in a zero elapsed time
elapsed_ns = max(time.time_ns() - start_time_ns, 1)
delta = dt.timedelta(microseconds=elapsed_ns / 1E3)
kbps = int(current_bytes // 8 * 1E6 / elapsed_ns)
kbps = int(current_bytes * 8E6 / elapsed_ns) # 8 bits per byte, 1E9 s per ns, 1E3 bits per kb
pps = int(current_packets * 1E9 / elapsed_ns)
info_str = f"[Elapsed: {delta}, " \
f"Parsed {current_bytes} bytes ({current_packets} packets) " \
Expand Down

0 comments on commit 57bc14d

Please sign in to comment.