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 computing Timestamps in Ruby #1099

Merged
merged 8 commits into from
Jul 21, 2020
Merged

Conversation

vincent-psarga
Copy link
Contributor

Summary

This should provide a fix for cucumber-ruby#1438

Basically, the timestamps generated by cucumber-messages are wrong (the way we used the Time.to_r does not really correspond to a seconds/nanos division).

This solution is not perfect as there are slight discrepencies during the conversion, less that 1e6 seconds that said, once again, slight).

I'll try to fix that too before merging.

Details

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • The change has been ported to Java.
  • The change has been ported to Ruby.
  • The change has been ported to JavaScript.
  • The change has been ported to Go.
  • The change has been ported to .NET.
  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have updated the CHANGELOG accordingly.

@vincent-psarga
Copy link
Contributor Author

I'd like this to be merged so we can make a release and show correct summaries with cucumber-ruby - do you think the 10e-6 precision its enough ? (I personally think so, I'd even think milliseconds would be largely enough as a precision for this kind of tests)

@mpkorstanje
Copy link
Contributor

Aside from using ISO 8601 rather then seconds since the epoch I don't see a better way to do this. I also think that sub millisecond precision is pointless.

@vincent-psarga
Copy link
Contributor Author

I also think that sub millisecond precision is pointless.

I agree and don't think anyone will have use of nanoseconds anyway. I think we've inherited that from the default Timestamp and Duration provided by protobuf (before we added our own messages for that), but I'm not sure this will prove useful anytime soon.

Copy link
Contributor

@luke-hill luke-hill left a comment

Choose a reason for hiding this comment

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

The code style / feel are all good. I've never used Timestamp personally, but it seems fairly self descriptive.

@vincent-psarga vincent-psarga merged commit 5ec6eda into master Jul 21, 2020
@vincent-psarga vincent-psarga deleted the fix-ruby-time-conversion branch July 21, 2020 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants