Are you using < 0 or <= 0 in your comparisons?
You should show us your code, so we know what is going on.
Let's try getting rid of the legacy code.
An Instant object encapsulates the time elapsed since 1st January 1970, just as a Date object does, but it multiplies the milliseconds by 1000000 to make nanoseconds. Now let's see if we can't get a current time
Instant object. Easy: use its
now() method and Bob's your uncle:-