Issue 514 using duration

#514 removing TimeUnit from the api and replacing it with Duration.