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

corrects tests for timestamp with nanosecond precision #7

Closed
wants to merge 1 commit into from

Conversation

desaikd
Copy link

@desaikd desaikd commented Jun 8, 2021

Description of changes:
This PR works on modifying tests for timestamps with nanoseconds precision to resolve test failure in amazon-ion/ion-hash-go#71 that bumps ion-go to v1.1.1.

For example a timestamp: 2021-05-27 00:19:05.000050000 has coefficient: 50000 and exponent: 9.
Inside encodeTimeDate function, we get the correct coefficient by calling time.Nanosecond which returns 50000 however the exponent is calculated by converting the coefficient to string and getting the length which returns 5 and is incorrect. The fix is to set the exponent to 9 if there are nanoseconds because time.time will always contain 9 precision units.

Changes:

  • Adds exponent as 9 in the binary timestamp value.

Related change: amazon-ion/ion-go#177

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@desaikd desaikd requested a review from zslayton June 8, 2021 19:19
@zslayton
Copy link

Per offline discussion, these tests actually caught a bug in ion-go (amazon-ion/ion-go#177).

@desaikd
Copy link
Author

desaikd commented Nov 21, 2022

This change isn't required anymore as there was a bug in ion-go which is fixed with v1.1.2

@desaikd desaikd closed this Nov 21, 2022
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.

2 participants