format duration correctly, add tests for formating duration