Function: timeclock-log
timeclock-log is a byte-compiled function defined in timeclock.el.gz.
Signature
(timeclock-log CODE &optional PROJECT)
Documentation
Log the event CODE to the timeclock log, at the time of call.
If PROJECT is a string, it represents the project which the event is being logged for. Normally only "in" events specify a project.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/timeclock.el.gz
(defun timeclock-log (code &optional project)
"Log the event CODE to the timeclock log, at the time of call.
If PROJECT is a string, it represents the project which the event is
being logged for. Normally only \"in\" events specify a project."
(let ((extant-timelog (find-buffer-visiting timeclock-file)))
(with-current-buffer (find-file-noselect timeclock-file t)
(save-excursion
(save-restriction
(widen)
(goto-char (point-max))
(if (not (bolp))
(insert "\n"))
(let ((now (current-time)))
(insert code " "
(format-time-string "%Y/%m/%d %H:%M:%S" now)
(or (and (stringp project)
(> (length project) 0)
(concat " " project))
"")
"\n")
(if (equal (downcase code) "o")
(setq timeclock-last-period
(float-time
(time-subtract now (cadr timeclock-last-event)))
timeclock-discrepancy
(+ timeclock-discrepancy
timeclock-last-period)))
(setq timeclock-last-event (list code now project)))))
(save-buffer)
(unless extant-timelog (kill-buffer (current-buffer)))))
(run-hooks 'timeclock-event-hook))