Skip to content

Rounding error #1

@frankgerhardt

Description

@frankgerhardt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions