summaryrefslogtreecommitdiff
path: root/HMSTime.hs
blob: ce4e3b26f8a8776adb605be052d5d99ddf7e4eb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module HMSTime
( diffTimeToHMSString
) where

import Data.Time.Clock( NominalDiffTime() )
import Text.Printf( printf )

diffTimeToHMSString :: NominalDiffTime -> String
diffTimeToHMSString delta = printf "%d:%02d:%02d" h m s
    where
        (mLeft, s) = floor delta `divMod` 60 :: (Int, Int)
        (h, m)     = mLeft `divMod` 60