     (save-mark-and-excursion
      (org-clock-find-position nil)
      (open-line 1)
-     (indent-according-to-mode)
-     (insert "CLOCK: ")
-     (org-insert-time-stamp starting-time t t)
-     (insert "--")
-     (org-insert-time-stamp ending-time t t)
-     (org-clock-update-time-maybe))))
+     (db/org-insert-clockline starting-time ending-time))))
 
 (bind-key "C-c C-x C-a" #'db/org-add-clocking-time org-mode-map)
 
 (defun db/org-add-clock-line-to-file (id start end)
   "Add clock line with START and END time to task identified by ID.
-TODO: specify time format"
+START and END must be given as org-mode timestamp strings."
   (let ((location (org-id-find id t)))
     (when (null location)
       (user-error "ID %s cannot be found" id))
     ;; Update existing clock lines
     (let ((new-start (org-time-string-to-seconds start))
-          (new-end   (org-time-string-to-seconds end))
-          (timestamp-format (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]")))
-      (org-with-point-at location
+          (new-end   (org-time-string-to-seconds end)))
+      (with-current-buffer (marker-buffer location)
         (db/org-map-clock-lines-and-entries
          (lambda (timestamp-1 timestamp-2)
            (let ((current-start (float-time

                          (concat date " 23:61")
                          files))

(defun db/org-add-clocking-time (starting-time ending-time)
  "Add \"CLOCK:\" line to the task under point in the current org-mode file."
  (interactive

                                        (org-parse-time-string timestamp-1))))
                 (current-end   (float-time
                                 (apply #'encode-time
                                        (org-parse-time-string timestamp-2))))
                 (kill-whole-line nil)  ; don’t delete newlines if not asked to
                 )
             (cond
              ;; if the current clock line is completely contained within the
              ;; given period, delete it
