@Override
    public boolean equals(Object obj) {
        if (obj instanceof DateTimeStamp) {
            DateTimeStamp other = (DateTimeStamp) obj;
            if (this.hasDateStamp())
                return this.getDateTime().equals(other.getDateTime()) &&
                        (this.getTimeStamp() == other.getTimeStamp());
            else
                return getTimeStamp() == other.getTimeStamp();
        }
        return false;
    }
@Test
    void testEquals() {
        DateTimeStamp a = new DateTimeStamp(0.586d);
        DateTimeStamp b = new DateTimeStamp(0.586d);
        assertEquals(a,b);
        assertEquals(b,a);
        b = new DateTimeStamp(.587);
        assertNotEquals(a, b);
        assertNotEquals(b,a);

        a = new DateTimeStamp("2018-04-04T09:10:00.586-0100");
        b = new DateTimeStamp("2018-04-04T09:10:00.586-0100");
        assertEquals(a, b);
        assertEquals(b,a);
        b = new DateTimeStamp("2018-04-04T09:10:00.587-0100");
        assertNotEquals(a, b);
        assertNotEquals(b,a);

        a = new DateTimeStamp("2018-04-04T09:10:00.586-0100", 0.18);
        b = new DateTimeStamp("2018-04-04T09:10:00.586-0100", 0.18);
        assertEquals(a, b);
        assertEquals(b,a);
        b = new DateTimeStamp("2018-04-04T09:10:00.586-0100", 0.19);
        assertNotEquals(a, b);
        assertNotEquals(b,a);

        b = new DateTimeStamp("2018-04-04T09:10:00.586-0200", 0.18);
        assertNotEquals(a, b);
        assertNotEquals(b,a);

        b = new DateTimeStamp("2018-04-04T09:10:00.586-0200", 0.19);
        assertNotEquals(a, b);
        assertNotEquals(b,a);

    }