Jeez, this seems like the easiest thing.
I have
def dueFromNow = 30.days.fromNow
dueFromNow
is a Deadline, but I need it in standard Unix time. Of course. Like everybody else.
Cannot find it in the docs, the code, or online.
Jeez, this seems like the easiest thing.
I have
def dueFromNow = 30.days.fromNow
dueFromNow
is a Deadline, but I need it in standard Unix time. Of course. Like everybody else.
Cannot find it in the docs, the code, or online.
I think there is no any direct conversion. You can get Unix time in Java 8 like this:
java.time.Instant.now().getEpochSecond()
So if have a Deadline
, you can get its timeLeft: FiniteDuration
and add to that value:
java.time.Instant.now().getEpochSecond() + 30.days.fromNow.timeLeft.toSeconds
It would be simpler to say just 30.days.toSeconds
, of course, if you have directly the FiniteDuration
.