Org mode allows you to clock the time you spend on specific tasks in a project. When you start working on an item, you can start the clock. When you stop working on that task, or when you mark the task done, the clock is stopped and the corresponding time interval is recorded. It also computes the total time spent on each subtree of a project. And it remembers a history or tasks recently clocked, to that you can jump quickly between a number of tasks absorbing your time.
To save the clock history across Emacs sessions, use
(setq org-clock-persist 'history)
(org-clock-persistence-insinuate)
When you clock into a new task after resuming Emacs, the incomplete clock1 will be found (see Resolving idle time) and you will be prompted about what to do with it.
:LOGBOOK: drawer (see also the variable
org-clock-into-drawer). When called with a C-u prefix argument,
select the task from a list of recently clocked tasks. With two C-u
C-u prefixes, clock into the task at point and mark it as the default task.
The default task will always be available when selecting a clocking task,
with letter d.CLOCK_MODELINE_TOTAL property. It may have the values
current to show only the current clocking instance, today to
show all time clocked on this tasks today (see also the variable
org-extend-today-until), all to include all time, or
auto which is the default4.org-log-note-clock-out for the
possibility to record an additional note together with the clock-out
timestamp5.
org-remove-highlights-with-change) or press C-c C-c.
#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
#+END: clocktable
If such a block already exists at point, its content is replaced by the new table. The ‘BEGIN’ line can specify options:
:maxlevel Maximum level depth to which times are listed in the table. :emphasize Whent, emphasize level one and level two items. :scope The scope to consider. This can be any of the following: nil the current buffer or narrowed region file the full current buffer subtree the subtree where the clocktable is located treeN the surrounding level N tree, for exampletree3tree the surrounding level 1 tree agenda all agenda files ("file"..) scan these files file-with-archives current file and its archives agenda-with-archives all agenda files, including archives :block The time block to consider. This block is specified either absolute, or relative to the current time and may be any of these formats: 2007-12-31 New year eve 2007 2007-12 December 2007 2007-W50 ISO-week 50 in 2007 2007 the year 2007 today, yesterday, today-N a relative day thisweek, lastweek, thisweek-N a relative week thismonth, lastmonth, thismonth-N a relative month thisyear, lastyear, thisyear-N a relative year Use S-<left>/<right> keys to shift the time interval. :tstart A time string specifying when to start considering times. :tend A time string specifying when to stop considering times. :stepweekorday, to split the table into chunks. To use this,:blockor:tstart,:tendare needed. :link Link the item headlines in the table to their origins. :formula Content of a#+TBLFMline to be added and evaluated. As a special case, ‘:formula %’ adds a column with % time. If you do not specify a formula here, any existing formula. below the clock table will survive updates and be evaluated. :timestamp A timestamp for the entry, when available. Look for SCHEDULED, DEADLINE, TIMESTAMP and TIMESTAMP_IA, in this order.
To get a clock summary of the current level 1 tree, for the current day, you could write
#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
#+END: clocktable
and to use a specific time range you could write6
#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
:tend "<2006-08-10 Thu 12:00>"
#+END: clocktable
A summary of the current subtree with % times would be
#+BEGIN: clocktable :scope subtree :link t :formula %
#+END: clocktable
#+BEGIN line of the dynamic block.
:block interval and update the table. The cursor
needs to be in the #+BEGIN: clocktable line for this command. If
:block is today, it will be shifted to today-1 etc.
The l key may be used in the timeline (see Timeline) and in the agenda (see Weekly/daily agenda) to show which tasks have been worked on or closed during a day.
[1] To resume the clock under the assumption that you have worked
on this task while outside Emacs, use (setq org-clock-persist t).
[2] To add an effort estimate “on the fly”,
hook a function doing this to org-clock-in-prepare-hook.
[3] as recorded by the LAST_REPEAT property
[4] See also the variable
org-clock-modeline-total.
[5] The corresponding in-buffer setting is:
#+STARTUP: lognoteclock-out
[6] Note that all parameters must be specified in a single line—the line is broken here only to fit it into the manual.