hledger/hledger-lib/hledger_timelog.5.md
Simon Michael 191c2e533f doc: generate man pages for each package (#282)
There are now six man pages, one for each main executable and file
format, generated from markdown by the mighty pandoc. They are basically
the content of the user manual, split up and moved into the appropriate
package directory.  I've also committed the generated man files.

The man pages' markdown source (hledger/hledger.1.md,
hledger-lib/hledger_journal.5.md etc.) are now the master documentation
files. The plan is to concatenate them (with a little munging) to form
the all-in-one user manual for the website, at release time.  This also
separates the hledger.org user manual from the latest doc commits, which
should simplify website management.
2015-10-20 06:26:09 -07:00

2.5 KiB

% hledger_timelog(5) % % October 2015

NAME

hledger_timelog - hledger's timelog file format

DESCRIPTION

hledger can read timelog files. As with Ledger, these are (a subset of) timeclock.el's format, containing clock-in and clock-out entries as in the example below. The date is a simple date (also, default year directives work). The time format is HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional. The timezone, if present, must be four digits and is ignored (currently the time is always interpreted as a local time).

i 2015/03/30 09:00:00 some:account name  optional description after two spaces
o 2015/03/30 09:20:00
i 2015/03/31 22:21:45 another account
o 2015/04/01 02:00:34

hledger treats each clock-in/clock-out pair as a transaction posting some number of hours to an account. Or if the session spans more than one day, it is split into several transactions, one for each day. For the above time log, hledger print generates these journal entries:

$ hledger -f t.timelog print
2015/03/30 * optional description after two spaces
    (some:account name)         0.33h

2015/03/31 * 22:21-23:59
    (another account)         1.64h

2015/04/01 * 00:00-02:00
    (another account)         2.01h

Here is a sample.timelog to download and some queries to try:

$ hledger -f sample.timelog balance                               # current time balances
$ hledger -f sample.timelog register -p 2009/3                    # sessions in march 2009
$ hledger -f sample.timelog register -p weekly --depth 1 --empty  # time summary by week

To generate time logs, ie to clock in and clock out, you could:

  • use emacs and the built-in timeclock.el, or the extended timeclock-x.el and perhaps the extras in ledgerutils.el

  • at the command line, use these bash aliases:

    alias ti="echo i `date '+%Y-%m-%d %H:%M:%S'` \$* >>$TIMELOG"
    alias to="echo o `date '+%Y-%m-%d %H:%M:%S'` >>$TIMELOG"
    
  • or use the old ti and to scripts in the ledger 2.x repository. These rely on a "timeclock" executable which I think is just the ledger 2 executable renamed.