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

unitconvert: round to nearest date when converting to yyyymmdd. #3111

Merged
merged 2 commits into from
Mar 14, 2022

Conversation

direvus
Copy link
Contributor

@direvus direvus commented Mar 11, 2022

This resolves an issue where converting from a low-precision decimalyear
to yyyymmdd gave a surprising result, due to mjd_to_yyyymmdd() truncating
away the fractional time component.

This commit changes the behaviour of mjd_to_yyyymmdd() to round to the
nearest date, instead of truncating.

Refs #1483

If this PR is accepted, then it supercedes pull #3074.

This resolves an issue where converting from a low-precision decimalyear
to yyyymmdd gave the wrong result, due to mjd_to_yyyymmdd() truncating
away the fractional time component.

This commit changes the behaviour of mjd_to_yyyymmdd() to round to the
nearest date, instead of truncating.

Refs OSGeo#1483
Copy link
Member

@kbevers kbevers left a comment

Choose a reason for hiding this comment

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

Minor nitpick, otherwise it looks good to me

src/conversions/unitconvert.cpp Outdated Show resolved Hide resolved
@kbevers
Copy link
Member

kbevers commented Mar 14, 2022

@direvus This looks good to me. Thanks for taking the time to sort this out.

@kbevers kbevers merged commit 77751f6 into OSGeo:master Mar 14, 2022
github-actions bot pushed a commit that referenced this pull request Mar 14, 2022
unitconvert: round to nearest date when converting to yyyymmdd.
@kbevers kbevers added this to the 9.0.1 milestone Mar 14, 2022
@direvus direvus deleted the 1483-round-to-date branch March 14, 2022 23:11
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.

unitconvert yyyymmdd to decimalyear error
2 participants