[Org] Change time representation for ‘db/org-add-clock-line-to-file’

This commit is contained in:
Daniel - 2018-01-13 18:29:37 +01:00
parent 766b12e4e3
commit 0bbaf4b62b
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 5 additions and 3 deletions

View File

@ -1106,13 +1106,15 @@ ending at 23:61. When not given, FILES defaults to
(defun db/org-add-clock-line-to-file (id start end) (defun db/org-add-clock-line-to-file (id start end)
"Add clock line with START and END time to task identified by ID. "Add clock line with START and END time to task identified by ID.
START and END must be given as org-mode timestamp strings." START and END must be given as time objects as returned by
`encode-time, or as an integer or float denoting seconds since
1970-01-01."
(let ((location (org-id-find id t))) (let ((location (org-id-find id t)))
(when (null location) (when (null location)
(user-error "ID %s cannot be found" id)) (user-error "ID %s cannot be found" id))
;; Update existing clock lines ;; Update existing clock lines
(let ((new-start (org-time-string-to-seconds start)) (let ((new-start (float-time start))
(new-end (org-time-string-to-seconds end))) (new-end (float-time end)))
(with-current-buffer (marker-buffer location) (with-current-buffer (marker-buffer location)
(db/org-map-clock-lines-and-entries (db/org-map-clock-lines-and-entries
(lambda (timestamp-1 timestamp-2) (lambda (timestamp-1 timestamp-2)