public DateTimeStamp add(double offsetInDecimalSeconds) {
        if (Double.isNaN(offsetInDecimalSeconds))
            throw new IllegalArgumentException("Cannot add " + Double.NaN);

        double adjustedTimeStamp = Double.NaN;
        ZonedDateTime adjustedDateStamp = null;
        if ( hasTimeStamp()) {
            adjustedTimeStamp = getTimeStamp() + offsetInDecimalSeconds;
        }

        if (hasDateStamp()) {
            double offset = (Double.isNaN(offsetInDecimalSeconds)) ? 0.000d : offsetInDecimalSeconds;
            int seconds = (int) offset;
            long nanos = ((long) ((offset % 1) * 1_000L)) * 1_000_000L;
            adjustedDateStamp = dateTime.plusSeconds(seconds).plusNanos(nanos);
        }

        return new DateTimeStamp(adjustedDateStamp, adjustedTimeStamp);
    }
@Test
    void add() {
        DateTimeStamp a = new DateTimeStamp(.586);
        double a_ts = a.getTimeStamp();
        ZonedDateTime a_dt = a.getDateTime();
        DateTimeStamp b = new DateTimeStamp(.586 + .587);
        assertEquals(b.getTimeStamp(), a.add(.587).getTimeStamp(), .001);
        assertEquals(a_ts, a.getTimeStamp(), .001); // test that a is unmodified
        assertEquals(a_dt, a.getDateTime()); // test that a is unmodified

        a = new DateTimeStamp("2018-04-04T09:10:00.586-0100");
        a_ts = a.getTimeStamp();
        a_dt = a.getDateTime();
        b = new DateTimeStamp("2018-04-04T09:10:01.173-0100");
        assertEquals(b.getDateTime(), a.add(.587).getDateTime());
        assertEquals(a_ts, a.getTimeStamp(), .001); // test that a is unmodified
        assertEquals(a_dt, a.getDateTime()); // test that a is unmodified

        a = new DateTimeStamp("2018-04-04T09:10:00.586-0100", 0.18);
        a_ts = a.getTimeStamp();
        a_dt = a.getDateTime();
        b = new DateTimeStamp("2018-04-04T09:10:01.173-0100", 0.18 + .587);
        DateTimeStamp c = a.add(.587);
        assertEquals(b.getDateTime(), c.getDateTime());
        assertEquals(b.getTimeStamp(), c.getTimeStamp(), 0.001);
        assertEquals(a_ts, a.getTimeStamp(), .001); // test that a is unmodified
        assertEquals(a_dt, a.getDateTime()); // test that a is unmodified

    }