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

fix: allow higher resolution timestamps #1570

Merged
merged 2 commits into from
Feb 21, 2023
Merged

Conversation

jm-clius
Copy link
Contributor

This fix allows higher precision Timestamps

Wakurtosis reported that all timestamps logged by nwaku were in second resolution (no fractional seconds), which is too imprecise for testing latency, identifying messages etc.

It turns out that our Timestamp construction converted the more precise floatseconds (with fraction) to int64 before multiplying, resulting in the fractional part always being truncated

I've also:

  • removed the unused util functions for micro- and milliseconds. I believe a nwaku Timestamp should always be nanoseconds.
  • made the generic generation function more strict in requiring SomeNumber types in input.
  • added basic test suite

Copy link
Contributor

@LNSD LNSD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

@jm-clius
Copy link
Contributor Author

Whoops. Naively assumed after local testing that CI will pass. Will investigate the failing tests.

Copy link
Contributor

@alrevuelta alrevuelta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apart from the ci issue, lgtm!

@jm-clius
Copy link
Contributor Author

Ci fixed, with higher resolution one test failed because it assumed several instructions can be completed in 1 nanosecond. :)

@jm-clius jm-clius merged commit 59203c7 into master Feb 21, 2023
@jm-clius jm-clius deleted the fix/timestamp-resolution branch February 21, 2023 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants