I feel like this question has been asked in one way or another, but I'm still not confident of my result.

I have an xsd:duration which will give me a desired expiration described in years, months, days, and seconds. I can collect the integer values of these parts with, for example, duration.getYears() or duration.getMonths().

Because my chosen db is Cassandra, I want to exploit the TTL option, which will automatically expire an inserted row after a specified number of seconds.

The critical part is getting from xsd:duration to an integer/long value of seconds which respects the Gregorian calendar (where 1 month from now is not simply 30.41 days, but 31).

At the moment, I'm using the following code:

LocalDateTime then = LocalDateTime.now().plusYears(duration.getYears()).plusMonths(duration.getMonths()).plusDays(duration.getDays()).plusHours(duration.getHours()).plusMinutes(duration.getMinutes()).plusSeconds(duration.getSeconds());
long ttlMillis = then.toInstant(ZoneOffset.UTC).toEpochMilli() - Instant.now().toEpochMilli();


Is there a quicker/cleaner way to do this?

I'm also not sure if I should worry about large durations... My particular use cases wouldn't call for anything larger that 2 years.


Question: How do you output the filename in find command while using -exec?
Answer: 
Use . -maxdepth 1 instead of ./*, you need only the first level in the folder structure
Use -type d, you need only folders
Use ! -name ".", you don't need .
Use -exec to start a shell
Use sh -c to start commands inside the shell


Your command

find . -maxdepth 1 -type d ! -name "." -exec sh -c 'echo "{}"; svnadmin verify "{}"' \;




or shorter


Use -prune if the file is a directory, do not descend into it


Your command

find . -mindepth 1 -prune -exec sh -c 'echo "{}"; svnadmin verify "{}"' \;