org-clock-sum gets the time logged for a header and all of its children. Is there a way to get the time logged ONLY for the top level header (but not its children?).


If by top level header you mean the outline level 1:

(org-clock-sum nil nil (lambda ()
                         (= (org-outline-level) 1)))


  (let ((level (org-outline-level)))
    (org-clock-sum nil nil (lambda ()
                             (= (org-outline-level) level)))))

See the third argument of the org-clock-sum function:

Headlines for which HEADLINE-FILTER returns nil are excluded from the clock summation.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.