Space Panda

Plain Text Time Accounting

Sometimes it’s quite nice to be able to see where time went. However, so do so in a plain text format.

Luckily for general (usually financial) accounting, there are projects like beancount (there’s also ledger, but I prefer the former).

Turns out time can be considered a commodity, like money, so keeping track of where time went is quite easy (and readable) with beancount:

;; -*- mode: beancount -*-
2021-01-01 commodity HR
  name: "Hours"

2021-01-01 open Equity:Life             HR
2021-01-01 open Expenses:Work           HR
2021-01-01 open Expenses:Work:Meetings  HR

2021-03-02 * ""
  Expenses:Work           2 HR
  Expenses:Work:Meetings  6 HR
  Equity:Life

That’s already a good start (whether or not Equity:Life is a good naming is probably rather a matter of taste), but you’ll quickly run into trouble as soon as you spent only a few minutes on something. Noting down 45 minutes of work like this is still possible, but quickly gets annoying:

2021-03-02 * ""
  Expenses:Work     0.75 HR
  Equity:Life

For that purpose I wrote a small plugin (beancounttime) for beancount that allows you to write down time in the HH.MM format:

;; -*- mode: beancount -*-
plugin "beancounttime.time" "HR"

2021-01-01 commodity HR
  name: "Hours"

2021-01-01 open Equity:Life             HR
2021-01-01 open Expenses:Work           HR
2021-01-01 open Expenses:Work:Meetings  HR

2021-03-02 * ""
  Expenses:Work           1.40 HR
  Expenses:Work:Meetings  6.30 HR
  Equity:Life            -8.10 HR

Another good use of this is to track your accumulated overtime:

;; -*- mode: beancount -*-
plugin "beancounttime.time" "HR"

2021-01-01 commodity HR
  name: "Hours"

2021-01-01 open Income:Employer  HR
2021-01-01 open Assets:Overtime  HR

2021-03-02 * ""
  Assets:Overtime    +0.10 HR
  Income:Employer

In this example, the 10 minutes overtime of that 8 hour workday on 2021-03-02 is kept for later.


Please be advised to not merge these two uses of time accounting into one unified approach, like in this bad example:

;; -*- mode: beancount -*-
;; bad example, don't do this

2021-01-01 open Equity:Life             HR
2021-01-01 open Expenses:Work           HR
2021-01-01 open Expenses:Work:Meetings  HR
2021-01-01 open Assets:Overtime         HR
2021-01-01 open Income:Employer         HR

2021-03-02 * "" ; again, not a good idea. Don't do this:
  Expenses:Work:Meetings  8.00 HR
  Assets:Overtime         0.30 HR
  Equity:Life            -8.30 HR

What did you spend the overtime on? Was it in a meeting? Or processing the emails that came in during this extra long meeting?

Of course, you can keep track of these still, just do that separately:

;; -*- mode: beancount -*-

2021-01-01 open Equity:Life             HR
2021-01-01 open Expenses:Work           HR
2021-01-01 open Expenses:Work:Meetings  HR
2021-01-01 open Assets:Overtime         HR
2021-01-01 open Income:Employer         HR

2021-03-02 * "" ; again, not a good idea. Don't do this:
  Expenses:Work:Meetings  8.00 HR
  Expenses:Work           8.30 HR ; e-mails
  Equity:Life            -8.30 HR

  Assets:Overtime         0.30 HR
  Income:Employer        -0.30 HR

Tagged as beancount, time