-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix precision issue on pcapng reader #1514
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We add a // PCPP patch
comment everywhere we change something in LightPcapNg so we can later hopefully contribute them to the original repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amended the commit
aed5aa3
to
a47c054
Compare
@mserdarsanli can you run If you don't know how to run it please let me know and I can run it for you |
The library persists timespec values correctly in the pcapng files, as it always uses nanosecond precision. But when reading pcapng file, to handle arbitrary precision, it uses floating point arithmetic and loses precision causing loaded tv_nsec values to be off up to 128 nanoseconds for timestamps around now.
d3bb349
to
d598e00
Compare
Fixed the clang-format issue for that file |
Thank you @mserdarsanli for working on this fix, much appreciated! 🙏 🙏 |
Added test shows the problem of lost precision caused by using doubles to convert 64-bit timestamps to tv_sec and tv_nsec values. Next commit is the fix making code use integer arithmetic and timestamps now load correctly.