- logfile_name : _ <- getArgs
- logfile_content <- readFile logfile_name
- let loglines = lines logfile_content
- loglines_split = map (splitOn ";") loglines
-
- entries = map (head . tail) loglines_split
-
- timestrings_finish = map head loglines_split
- timestrings_start = "" : init timestrings_finish
-
- timestamps_finish = map timestringToEpoch timestrings_finish
- timestamps_start = 0 : init timestamps_finish
-
- timestamps_deltas = zipWith (-) timestamps_finish timestamps_start
- timestamps_deltas_HMMSS = map secondsToHMMSS timestamps_deltas
-
- delta_entry_tuples = zip timestamps_deltas_HMMSS entries
- summaries = zip4 (map show timestrings_start) (map show timestrings_finish) timestamps_deltas_HMMSS entries
-
- forM_ summaries $ \(start, finish, delta, entry) ->
- putStrLn $ concat $ intersperse ";" [start, finish, delta, entry]
-
-timestringToEpoch :: String -> Integer
-timestringToEpoch = fromJust . approxidate
-
-secondsToHMMSS :: (Num seconds, Show seconds, Integral seconds, Text.Printf.PrintfArg seconds) => seconds -> String
-secondsToHMMSS seconds = printf "%d:%02d:%02d" h m s
- where
- (mLeft, s) = seconds `divMod` 60
- (h, m) = mLeft `divMod` 60
-
-getStartOfDay :: Num t => t -> t
-getStartOfDay time = 0