Previous: Daylight Savings, Up: Calendar/Diary


39.14 Summing Time Intervals

The timeclock feature adds up time intervals, so you can (for instance) keep track of how much time you spend working.

Use the M-x timeclock-in command when you start working on a project, and M-x timeclock-out command when you're done. Each time you do this, it adds one time interval to the record of the project. You can change to working on a different project with M-x timeclock-change.

Once you've collected data from a number of time intervals, you can use M-x timeclock-workday-remaining to see how much time is left to work today (assuming a typical average of 8 hours a day), and M-x timeclock-when-to-leave which will calculate when you're “done.”

If you want Emacs to display the amount of time “left” of your workday in the mode line, either customize the timeclock-modeline-display variable and set its value to t, or invoke the M-x timeclock-modeline-display command.

Terminating the current Emacs session might or might not mean that you have stopped working on the project and, by default, Emacs queries this. You can, however, set the value of the variable timeclock-ask-before-exiting to nil (via M-x customize) to avoid this behavior; then, only an explicit M-x timeclock-out or M-x timeclock-change will tell Emacs that the current interval is over.

The timeclock functions work by accumulating the data in a file called .timelog in your home directory. You can specify a different name for this file by customizing the variable timeclock-file. If you edit the timeclock file manually, or if you change the value of any of timeclock's customizable variables, you should run the command M-x timeclock-reread-log to update the data in Emacs from the file.