diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-26 12:07:00 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-26 12:07:00 -0400 |
commit | fdec6d27c4d32b9d641d17336b6be4a91c1d3fc4 (patch) | |
tree | 106833d461ef75b1dd2c4c21988b34c13c79f2a2 /Utility/HumanTime.hs | |
parent | 47aa0b60f458a393cbe3bbbee684dcf54d66a96d (diff) |
parse "5" as 5 seconds
Diffstat (limited to 'Utility/HumanTime.hs')
-rw-r--r-- | Utility/HumanTime.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Utility/HumanTime.hs b/Utility/HumanTime.hs index c55c862ca..644e6fbab 100644 --- a/Utility/HumanTime.hs +++ b/Utility/HumanTime.hs @@ -35,9 +35,11 @@ parseDuration = Duration <$$> go 0 go n [] = return n go n s = do num <- readish s :: Maybe Integer - let (c:rest) = dropWhile isDigit s - u <- M.lookup c unitmap - go (n + num * u) rest + case dropWhile isDigit s of + (c:rest) -> do + u <- M.lookup c unitmap + go (n + num * u) rest + _ -> return $ n + num fromDuration :: Duration -> String fromDuration Duration { durationSeconds = d } |