hledger-lib-1.50.3: A library providing the core functionality of hledger

Safe Haskell | None
Language | GHC2021

Hledger.Data.Timeclock

Contents

- Orphan instances

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.

tests_Timeclock :: TestTree Source #

# Orphan instances

Read TimeclockCode Source # |
Instance details Methods readsPrec :: Int -> ReadS TimeclockCode Source # readList :: ReadS [TimeclockCode] Source # readPrec :: ReadPrec TimeclockCode Source # readListPrec :: ReadPrec [TimeclockCode] Source #
Show TimeclockCode Source # |
Instance details Methods showsPrec :: Int -> TimeclockCode -> ShowS Source # show :: TimeclockCode -> String Source # showList :: [TimeclockCode] -> ShowS Source #
Show TimeclockEntry Source # |
Instance details Methods showsPrec :: Int -> TimeclockEntry -> ShowS Source # show :: TimeclockEntry -> String Source # showList :: [TimeclockEntry] -> ShowS Source #