Skip to content

Commit

Permalink
show zoned time
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichael committed Oct 21, 2016
1 parent 8593e58 commit 7a5dc67
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/QuickBench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import Data.List
import Data.List.Split (splitOn)
import Data.Maybe
import Data.Time.Clock
-- import Data.Time.Format ()
import Data.Time.Format
import Data.Time.LocalTime
import Safe
import System.Console.Docopt
import System.Directory
Expand Down Expand Up @@ -132,14 +133,14 @@ defaultMain =
when (null cmds) $ do
out opts "No test commands found; provide some as arguments, with -f, or in ./bench.sh\n"
exitSuccess
now <- getCurrentTime
now <- getCurrentZonedTime
out opts $ printf "Running %d tests %d times%s at %s:\n"
(length cmds)
(iterations opts)
(case executables opts of
[] -> ""
es -> printf " with %d executables" (length es))
(show now)
(formatTime defaultTimeLocale "%Y-%m-%d %T %Z" now)
let
exes = case executables opts of
[] -> [""]
Expand All @@ -149,6 +150,12 @@ defaultMain =
results <- mapM (runTestWithExes opts exes) cmds
printSummary opts cmds exes cyc results

getCurrentZonedTime :: IO ZonedTime
getCurrentZonedTime = do
t <- getCurrentTime
tz <- getCurrentTimeZone
return $ utcToZonedTime tz t

runTestWithExes :: Opts -> [String] -> String -> IO [[Float]]
runTestWithExes opts exes cmd = mapM (runTestWithExe opts cmd) exes

Expand Down

0 comments on commit 7a5dc67

Please sign in to comment.