1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-01 11:15:00 +00:00

Add new parameter to the `org-clock-out' command

(org-clock-out): Accept new third parameter `at-time', which permits a
clock to be clocked out at a specific time.  Note that no attempt is
made to verify that the clock out time is later than the clock in time.
This commit is contained in:
John Wiegley 2009-10-16 22:08:01 -04:00
parent b6594a03df
commit cc039d9016
2 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,10 @@
* org-clock.el (org-clock-in): Before creating
`org-clock-mode-line-timer', check to make sure an older timer is
not currently running.
(org-clock-out): Accept new third parameter `at-time', which
permits a clock to be clocked out at a specific time. Note that
no attempt is made to verify that the clock out time is later than
the clock in time.
* org.el (org-files-list): New utility function for returning a
list of all open org-mode buffers, plus all files used to build

View File

@ -751,7 +751,7 @@ line and position cursor in that line."
(and (re-search-forward org-property-end-re nil t)
(goto-char (match-beginning 0))))))))
(defun org-clock-out (&optional fail-quietly)
(defun org-clock-out (&optional fail-quietly at-time)
"Stop the currently running clock.
If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
(interactive)
@ -772,7 +772,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
(goto-char (match-end 0))
(delete-region (point) (point-at-eol))
(insert "--")
(setq te (org-insert-time-stamp (current-time) 'with-hm 'inactive))
(setq te (org-insert-time-stamp (or at-time (current-time))
'with-hm 'inactive))
(setq s (- (org-float-time (apply 'encode-time (org-parse-time-string te)))
(org-float-time (apply 'encode-time (org-parse-time-string ts))))
h (floor (/ s 3600))