Re: Using Ledger as a time tracking system?

1,175 views
Skip to first unread message

John Wiegley

unread,
Apr 2, 2013, 12:07:09 PM4/2/13
to ledge...@googlegroups.com
>>>>> Colin Dean <c...@cad.cx> writes:

> Has anyone used Ledger as a means for tracking time?

What a great question! since this is my primary use for Ledger now. :)

Ledger directly supports "timelog" entries, which have this form:

i 2013/03/28 22:13:00 ACCOUNT[ PAYEE]
o 2013/03/29 03:39:00

This records a check-in to the given ACCOUNT, and a check-out. You can be
checked-in to multiple accounts at a time, if you wish, and they can span
multiple days (use --day-break to break them up in the report). The number of
seconds between is accumulated as time to that ACCOUNT. If the checkout uses
a capital "O", the transaction is marked "cleared". You can use an optional
PAYEE for whatever meaning you like.

Now, there are a few ways to generate this information. You can use the
timeclock.el package, which is part of Emacs. Or you can use Org-mode's
time-clocking abilities and my attached org2tc script. Or you can write a
simple script in whichever language you prefer to emit similar information.

These timelog entries can appear in a separate file, or directly in your main
ledger file. The initial "i" and "o" count as Ledger "directives", and are
accepted anywhere that ordinary transactions are.

I further run this program through a program I call "hours", which generates a
text display for me like this (I show this on my desktop at 5 minutes
intervals using GeekTool):

0.8% ↓2.4h (166.7h)
⏱ 1.30h

This shows me my temporal progress against a full-time work month, how many
hours are left in the month, and -- if I'm clocked in -- how many hours I've
worked today. I have this program up on GitHub:

https://github.com/jwiegley/hours

Hope this helps,
John

org2tc

Craig Earls

unread,
Apr 2, 2013, 12:09:52 PM4/2/13
to ledge...@googlegroups.com
I need to add this to the docuemntation, it is silent on the time
tracking stuff :(
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

John Wiegley

unread,
Apr 2, 2013, 12:26:41 PM4/2/13
to ledge...@googlegroups.com
>>>>> Craig Earls <ende...@gmail.com> writes:

> I need to add this to the docuemntation, it is silent on the time tracking
> stuff :(

That would be a great addition, thanks Craig!

John

Colin Dean

unread,
Apr 7, 2013, 8:04:01 PM4/7/13
to ledge...@googlegroups.com, jo...@newartisans.com
Having some good documentation would make this a lot easier to understand. I messed around with it a little last night, but I'm getting caught up on the options because I don't know ledger's options very well yet. 

[colin@kid tmp]$ cat time.ledger
i 2013/04/05 09:30:00 Internal:Meeting:Tactical [Intelligent comment]
o 2013/04/05 10:00:00
i 2013/04/05 10:00:00 CustomerA:Email
o 2013/04/05 10:05:00
i 2013/04/05 10:05:00 CustomerB:Config
o 2013/04/05 11:30:00
i 2013/04/05 11:30:00 Personal:Walk
o 2013/04/05 12:00:00
i 2013/04/05 12:00:00 Personal:Lunch
o 2013/04/05 13:30:00
[colin@kid tmp]$ ledger -f time.ledger  print
2013/04/05 ()
    (Internal:Meeting:Tactical [Intelligent comment])       1800s

2013/04/05 ()
    (CustomerA:Email)                           300s

2013/04/05 ()
    (CustomerB:Config)                         5100s

2013/04/05 ()
    (Personal:Walk)                            1800s

2013/04/05 ()
    (Personal:Lunch)                           5400s

I'd like for the output to be grouped by day and the time in hours rounded to one decimal place.

thierry

unread,
Apr 8, 2013, 3:29:53 PM4/8/13
to ledge...@googlegroups.com, jo...@newartisans.com
$ ledger --daily register 
13-Apr-05 - 13-Apr-05   (CustomerA:Email)          5.0m     5.0m
                        (CustomerB:Config)        1.42h    1.50h
                        ..ntelligent comment])    30.0m    2.00h
                        (Personal:Lunch)          1.50h    3.50h
                        (Personal:Walk)           30.0m    4.00h

Colin Dean

unread,
Apr 8, 2013, 7:12:03 PM4/8/13
to ledge...@googlegroups.com
You have no idea how happy this makes me.

Thanks, folks. I've found the right tool! For multiple jobs!

-- 
Colin Dean

--
 
---
You received this message because you are subscribed to a topic in the Google Groups "Ledger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ledger-cli/XVR4t1B-XFI/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to ledger-cli+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages