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

Rounding error #1

Open
frankgerhardt opened this issue Sep 26, 2015 · 0 comments
Open

Rounding error #1

frankgerhardt opened this issue Sep 26, 2015 · 0 comments

Comments

@frankgerhardt
Copy link

I added the following test to OleAutomationDateUtilTest

        assertThat("Day 2015"
                   , oadu.fromOADate(42095.99407407407, GMT)
                   , equalTo(d("Apr 1, 2015 11:51:27 pm GMT")));

and I get the following error

java.lang.AssertionError: Day 2015
Expected: <Thu Apr 02 01:51:27 CEST 2015>
     but: was <Thu Apr 02 01:51:27 CEST 2015>
    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)

The dates look the same but they differ in their milliseconds.

I wrote my own method similar to fromOADate(double d, TimeZone tz) and pull out days, hours, minutes and seconds one by one out of the fraction ignoring millis and anything smaller (can't share it, sorry, but you get the idea).

It would be interesting if you can reproduce the error by copying the lines above into your test.

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

No branches or pull requests

1 participant