Previous: Tracking TODO state changes, Up: Progress logging


6.5.3 Clocking work time

Org-mode allows you to clock the time you spent 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.

C-c C-x C-i
Start the clock on the current item (clock-in). This inserts the CLOCK keyword together with a timestamp.
C-c C-x C-o
Stop the clock (clock-out). The inserts another timestamp at the same location where the clock was last started. It also directly computes the resulting time in inserts it after the time range as `=> HH:MM'. See the variable org-log-done for the possibility to record an additional note together with the clock-out time stamp1.
C-c C-y
Recompute the time interval after changing one of the time stamps. This is only necessary if you edit the time stamps directly. If you change them with S-<cursor> keys, the update is automatic.
C-c C-t
Changing the TODO state of an item to DONE automatically stops the clock if it is running in this same item.
C-c C-x C-x
Cancel the current clock. This is useful if a clock was started by mistake, or if you ended up working on something else.
C-c C-x C-d
Display time summaries for each subtree in the current buffer. This puts overlays at the end of each headline, showing the total time recorded under that heading, including the time of any subheadings. You can use visibility cycling to study the tree, but the overlays disappear when you change the buffer (see variable org-remove-highlights-with-change) or press C-c C-c.
C-c C-x C-r
Insert a dynamic block (see Dynamic blocks) containing a clock report as an org-mode table into the current file.
          #+BEGIN: clocktable :maxlevel 2 :emphasize nil
          
          #+END: clocktable
     

If such a block already exists, its content is replaced by the new table. The `BEGIN' line can specify options:

          :maxlevels   Maximum level depth to which times are listed in the table.
          :emphasize   When t, emphasize level one and level two items
          :block       The time block to consider.  This block is specified relative
                       to the current time and may be any of these keywords:
                       today, yesterday, thisweek, lastweek,
                       thismonth, lastmonth, thisyear, or lastyear.
          :tstart      A time string specifying when to start considering times
          :tend        A time string specifying when to stop considering times
     

So to get a clock summary for the current day, you could write

          #+BEGIN: clocktable :maxlevel 2 :block today
          
          #+END: clocktable
     

and to use a specific time range you could write2

          #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
                              :tend "<2006-08-10 Thu 12:00>"
          
          #+END: clocktable
     


C-u C-c C-x C-u
Update all dynamic blocks (see Dynamic blocks). This is useful if you have several clocktable blocks in a buffer.

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.


Footnotes

[1] The corresponding in-buffer setting is: #+STARTUP: lognoteclock-out

[2] Note that all parameters must be specified in a single line - the line is broken here only to fit it onto the manual.