Skip to content
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

Question regarding the drop of nanosecond precision timestamp #1189

Open
Teles1 opened this issue Sep 6, 2023 · 2 comments
Open

Question regarding the drop of nanosecond precision timestamp #1189

Teles1 opened this issue Sep 6, 2023 · 2 comments

Comments

@Teles1
Copy link

Teles1 commented Sep 6, 2023

The nanosecond precision is lost while re-assembling a TCP stream. I needed to know the timestamp for when a portion of a given stream arrived and unfortunately the precision was lost. Was this a design decision or if a pull request comes in to change this to timespec for example would it get merged in? Thanks

TIMESPEC_TO_TIMEVAL(&out, &in);

@seladb
Copy link
Owner

seladb commented Sep 7, 2023

Hi @Teles1 ! I found the commit where it was changed: 2583f64#diff-654f2a86f6954fcb6e711df2d4550f16028c3f79c08b2a7bc851dfa227dc37d2

As you can see, it was added when the packet timestamp became more accurate and changed from timeval to timespec. I assume we didn't want to change the ConnectionData and TcpStreamData structs and keep them backward compatible so we decided to just convert timespec back to timeval.

However, I think it can be a nice change to deprecate timeval and move to a struct with higher precision. It can be either timespec or a more C++11-style structure like std::chrono::time_point.

In order to stay backward compatible I'd keep the timeval properties in ConnectionData and TcpStreamData, mark them as deprecated and add new timespec / std::chrono::time_point properties. In the next version we can remove the timeval properties completely.

Would you consider implementing this change?

@Teles1
Copy link
Author

Teles1 commented Sep 7, 2023

Sure. Will do.

Edit: I mean, I'll definitively give it a shot 👍 I don't know exactly the ins and outs of the tcp protocol but looking at the implementation it doesn't look that will matter all that much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants