Inserting values failed when timestamp is in future and TTL is calculated

Description

Inserting values with a future timestamp fails with an Exception if calculateTimeToLive is set to ```true```.

The following exception is raied:
```
java.lang.IllegalArgumentException: you can only subtract an earlier date from a later one... negative durations don't make sense
at org.opennms.newts.api.Timestamp.minus(Timestamp.java:77) ~[newts-api-1.3.3-SNAPSHOT.jar:?]
at org.opennms.newts.persistence.cassandra.CassandraSampleRepository.insert(CassandraSampleRepository.java:245) ~[newts-cassandra-1.3.3-SNAPSHOT.jar:?]
```

This also happens if the timestamp is equal to the current one.

Lucidchart Diagrams

Activity

Show:

fooker November 23, 2015 at 5:52 PM

Fixed

Details

Assignee

Reporter

Fix versions

Affects versions

Priority

PagerDuty

Created November 23, 2015 at 5:24 PM
Updated November 23, 2015 at 7:32 PM
Resolved November 23, 2015 at 7:32 PM

Flag notifications