Skip to content

Commit 7a5dc67

Browse files
committed
show zoned time
1 parent 8593e58 commit 7a5dc67

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/QuickBench.hs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import Data.List
1111
import Data.List.Split (splitOn)
1212
import Data.Maybe
1313
import Data.Time.Clock
14-
-- import Data.Time.Format ()
14+
import Data.Time.Format
15+
import Data.Time.LocalTime
1516
import Safe
1617
import System.Console.Docopt
1718
import System.Directory
@@ -132,14 +133,14 @@ defaultMain =
132133
when (null cmds) $ do
133134
out opts "No test commands found; provide some as arguments, with -f, or in ./bench.sh\n"
134135
exitSuccess
135-
now <- getCurrentTime
136+
now <- getCurrentZonedTime
136137
out opts $ printf "Running %d tests %d times%s at %s:\n"
137138
(length cmds)
138139
(iterations opts)
139140
(case executables opts of
140141
[] -> ""
141142
es -> printf " with %d executables" (length es))
142-
(show now)
143+
(formatTime defaultTimeLocale "%Y-%m-%d %T %Z" now)
143144
let
144145
exes = case executables opts of
145146
[] -> [""]
@@ -149,6 +150,12 @@ defaultMain =
149150
results <- mapM (runTestWithExes opts exes) cmds
150151
printSummary opts cmds exes cyc results
151152

153+
getCurrentZonedTime :: IO ZonedTime
154+
getCurrentZonedTime = do
155+
t <- getCurrentTime
156+
tz <- getCurrentTimeZone
157+
return $ utcToZonedTime tz t
158+
152159
runTestWithExes :: Opts -> [String] -> String -> IO [[Float]]
153160
runTestWithExes opts exes cmd = mapM (runTestWithExe opts cmd) exes
154161

0 commit comments

Comments
 (0)