0

I have a org-mode buffer full of the clock-ins & clock-outs and I want to sum the intervals which have the form of x:xx, like 0:13 in the following range:

* Tasks

** btc-admin
   CLOCK: [2017-06-13 Tue 12:59]--[2017-06-13 Tue 13:12] =>  0:13
   CLOCK: [2017-06-13 Tue 12:29]--[2017-06-13 Tue 12:59] =>  0:30
   CLOCK: [2017-06-12 Mon 20:29]--[2017-06-12 Mon 22:05] =>  1:36

*** 257
    CLOCK: [2017-06-22 Thu 15:15]--[2017-06-22 Thu 17:05] =>  1:50
    CLOCK: [2017-06-22 Thu 10:54]--[2017-06-22 Thu 11:15] =>  0:21
    CLOCK: [2017-06-22 Thu 15:54]--[2017-06-22 Thu 19:05] =>  3:11
    CLOCK: [2017-06-21 Wed 14:25]--[2017-06-21 Wed 15:19] =>  0:54
    CLOCK: [2017-06-20 Tue 21:58]--[2017-06-20 Tue 23:15] =>  1:17
    CLOCK: [2017-06-20 Tue 18:36]--[2017-06-20 Tue 21:58] =>  3:22
    CLOCK: [2017-06-20 Tue 15:18]--[2017-06-20 Tue 15:36] =>  0:18
    CLOCK: [2017-06-20 Tue 12:00]--[2017-06-20 Tue 12:25] =>  0:25
    CLOCK: [2017-06-17 Sat 17:40]--[2017-06-17 Sun 18:00] =>  0:20

*** 277
    CLOCK: [2017-06-22 Thu 17:05]--[2017-06-22 Thu 17:41] =>  0:36

* Tasks

** btc-admin
   CLOCK: [2017-06-13 Tue 12:59]--[2017-06-13 Tue 13:12] =>  0:13
   CLOCK: [2017-06-13 Tue 12:29]--[2017-06-13 Tue 12:59] =>  0:30
   CLOCK: [2017-06-12 Mon 20:29]--[2017-06-12 Mon 22:05] =>  1:36

*** 257
    CLOCK: [2017-06-22 Thu 15:15]--[2017-06-22 Thu 17:05] =>  1:50
    CLOCK: [2017-06-22 Thu 10:54]--[2017-06-22 Thu 11:15] =>  0:21
    CLOCK: [2017-06-22 Thu 15:54]--[2017-06-22 Thu 19:05] =>  3:11
    CLOCK: [2017-06-21 Wed 14:25]--[2017-06-21 Wed 15:19] =>  0:54
    CLOCK: [2017-06-20 Tue 21:58]--[2017-06-20 Tue 23:15] =>  1:17
    CLOCK: [2017-06-20 Tue 18:36]--[2017-06-20 Tue 21:58] =>  3:22
    CLOCK: [2017-06-20 Tue 15:18]--[2017-06-20 Tue 15:36] =>  0:18
    CLOCK: [2017-06-20 Tue 12:00]--[2017-06-20 Tue 12:25] =>  0:25
    CLOCK: [2017-06-17 Sat 17:40]--[2017-06-17 Sun 18:00] =>  0:20

*** 277
    CLOCK: [2017-06-22 Thu 17:05]--[2017-06-22 Thu 17:41] =>  0:36

I want to use the Emacs Calc to sum them together but I don't know how. I know there is a way provided by org-mode to get a gtd-table. I just want to learn some Emacs Calc basic ideas from this practice.

  • If I were you, I would find out the name of the org-mode function that does this and go study its code. I suspect that you need a lot more structure that just calc to get all the times (a problem that calc does not help with). The summing of them is the easy part. – NickD Jun 22 '17 at 13:46
  • Thanks for your advice. org-mode uses a more than 120 lines function to calc the time, hard coded. AFAIK, calc can grab data from range, so I can grab the time intervals to a rectangle range and send it to calc. But I don't know how to unpack the time intervals and calc the sum in calc. I think calc may have this ability. Do you have any ideas? – cmal Jun 23 '17 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.