2015-06-29 02:12:32 +03:00
|
|
|
#!/usr/bin/env runhaskell
|
|
|
|
{-
|
2016-04-13 07:10:02 +03:00
|
|
|
generatetimeclock.hs NUMENTRIES
|
2015-06-29 02:12:32 +03:00
|
|
|
|
2016-04-13 07:10:02 +03:00
|
|
|
Outputs a dummy timeclock log with the specified number of clock-in/clock-out entries,
|
2015-06-29 02:12:32 +03:00
|
|
|
one per day.
|
|
|
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Main
|
|
|
|
where
|
|
|
|
import System.Environment
|
|
|
|
import Data.Time.LocalTime
|
|
|
|
import Data.Time.Calendar
|
|
|
|
import Text.Printf
|
|
|
|
|
|
|
|
main = do
|
|
|
|
args <- getArgs
|
|
|
|
let [numentries] = map read args :: [Integer]
|
|
|
|
today <- getCurrentDay
|
|
|
|
let startdate = addDays (-numentries) today
|
|
|
|
mapM_ (putStr . showentry) [startdate..today]
|
|
|
|
|
|
|
|
showentry d =
|
|
|
|
printf "i %s 09:00:00 dummy\no %s 17:00:00\n" (show d) (show d)
|
|
|
|
|
2021-08-16 07:49:40 +03:00
|
|
|
getCurrentDay = localDay . zonedTimeToLocalTime <$> getZonedTime
|