Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hledger.Data.Timeclock
Contents
Description
A TimeclockEntry
is a clock-in, clock-out, or other directive in a timeclock
file (see timeclock.el or the command-line version). These can be
converted to Transactions
and queried like a ledger.
Synopsis
- timeclockToTransactions :: LocalTime -> [TimeclockEntry] -> [Transaction]
- timeclockToTransactionsOld :: LocalTime -> [TimeclockEntry] -> [Transaction]
- tests_Timeclock :: TestTree
Documentation
timeclockToTransactions :: LocalTime -> [TimeclockEntry] -> [Transaction] Source #
Convert timeclock entries to journal transactions. This is the new, default version added in hledger 1.43 and improved in 1.50. It allows concurrent clocked-in sessions (though not with the same account name), and clock-in/clock-out entries in any order.
Entries are processed in parse order. Sessions crossing midnight are split into days to give accurate per-day totals. At the end, any sessions with no clockout get an implicit clockout with the provided "now" time. If any entries cannot be paired as expected, an error is raised.
timeclockToTransactionsOld :: LocalTime -> [TimeclockEntry] -> [Transaction] Source #
Convert timeclock entries to journal transactions. This is the old version from hledger <1.43, now enabled by --old-timeclock. It requires strictly alternating clock-in and clock-entries. It was documented as allowing only one clocked-in session at a time, but in fact it allows concurrent sessions, even with the same account name.
Entries must be a strict alternation of in and out, beginning with in. When there is no clockout, one is added with the provided current time. Sessions crossing midnight are split into days to give accurate per-day totals. If entries are not in the expected in/out order, an error is raised.
Orphan instances
Read TimeclockCode Source # | |
Methods readsPrec :: Int -> ReadS TimeclockCode # readList :: ReadS [TimeclockCode] # | |
Show TimeclockCode Source # | |
Methods showsPrec :: Int -> TimeclockCode -> ShowS # show :: TimeclockCode -> String # showList :: [TimeclockCode] -> ShowS # | |
Show TimeclockEntry Source # | |
Methods showsPrec :: Int -> TimeclockEntry -> ShowS # show :: TimeclockEntry -> String # showList :: [TimeclockEntry] -> ShowS # |