2016-05-29 09:31:44 +03:00
|
|
|
% hledger_timeclock(5) hledger _version_
|
|
|
|
% _author_
|
|
|
|
% _monthyear_
|
2015-10-20 16:26:09 +03:00
|
|
|
|
2016-04-16 20:09:51 +03:00
|
|
|
_web_({{
|
2017-01-04 21:50:16 +03:00
|
|
|
_docversionlinks_({{timeclock}})
|
2016-04-16 21:00:39 +03:00
|
|
|
_toc_
|
2016-04-16 20:09:51 +03:00
|
|
|
}})
|
|
|
|
_man_({{
|
2016-02-21 13:32:40 +03:00
|
|
|
|
2015-10-20 16:26:09 +03:00
|
|
|
# NAME
|
|
|
|
|
2016-04-13 07:10:02 +03:00
|
|
|
Timeclock - the time logging format of timeclock.el, as read by hledger
|
2015-10-20 16:26:09 +03:00
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
2016-04-16 20:09:51 +03:00
|
|
|
}})
|
2016-02-21 13:32:40 +03:00
|
|
|
|
2016-04-13 07:10:02 +03:00
|
|
|
hledger can read timeclock files.
|
2015-10-20 16:26:09 +03:00
|
|
|
[As with Ledger](http://ledger-cli.org/3.0/doc/ledger3.html#Time-Keeping),
|
|
|
|
these are (a subset of)
|
|
|
|
[timeclock.el](http://www.emacswiki.org/emacs/TimeClock)'s format,
|
|
|
|
containing clock-in and clock-out entries as in the example below.
|
2016-05-18 05:46:54 +03:00
|
|
|
The date is a [simple date](#simple-dates).
|
2015-10-20 16:26:09 +03:00
|
|
|
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).
|
|
|
|
|
2016-04-13 07:10:02 +03:00
|
|
|
```timeclock
|
2015-10-20 16:26:09 +03:00
|
|
|
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:
|
|
|
|
|
|
|
|
``` {.shell}
|
2016-04-13 07:10:02 +03:00
|
|
|
$ hledger -f t.timeclock print
|
2015-10-20 16:26:09 +03:00
|
|
|
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
|
2017-01-08 16:20:04 +03:00
|
|
|
[sample.timeclock](https://raw.github.com/simonmichael/hledger/master/examples/sample.timeclock) to
|
2015-10-20 16:26:09 +03:00
|
|
|
download and some queries to try:
|
|
|
|
|
|
|
|
```shell
|
2016-04-13 07:10:02 +03:00
|
|
|
$ hledger -f sample.timeclock balance # current time balances
|
|
|
|
$ hledger -f sample.timeclock register -p 2009/3 # sessions in march 2009
|
|
|
|
$ hledger -f sample.timeclock register -p weekly --depth 1 --empty # time summary by week
|
2015-10-20 16:26:09 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
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](http://www.emacswiki.org/emacs/timeclock-x.el)
|
|
|
|
and perhaps the extras in [ledgerutils.el](http://hub.darcs.net/simon/ledgertools/ledgerutils.el)
|
|
|
|
|
|
|
|
- at the command line, use these bash aliases:
|
|
|
|
```shell
|
|
|
|
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](https://github.com/ledger/ledger/tree/maint/scripts).
|
|
|
|
These rely on a "timeclock" executable which I think is just the ledger 2 executable renamed.
|