[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reporting using timeclock?
From: |
Brendan Halpin |
Subject: |
Re: reporting using timeclock? |
Date: |
24 Sep 2003 11:17:53 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 |
ASH JAMES <james.ash@sbc.com> writes:
> Is anyone aware of an extension that will summarize a .timelog file,
> presenting number of hours worked by project?
A late reply...
If you're into elisp, timeclock's structures are easy to
manipulate, e.g.:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun bhtl-generate-report ()
(interactive)
(switch-to-buffer (get-buffer-create "*TC-Report*"))
(delete-region (point-min) (point-max))
(let ((stuff (nth 2 (timeclock-log-data))))
(while stuff
(let ((project-data (pop stuff))
(time 0))
(insert (format "%16s: " (pop project-data)))
(while project-data
(let* ((proj-entry (pop project-data)))
(incf time (-
(timeclock-time-to-seconds (nth 1 proj-entry))
(timeclock-time-to-seconds (nth 0 proj-entry))))))
(insert (seconds-to-hms time) ?\n)))))
(defun seconds-to-hms (secs)
(let ((secint (round (ftruncate secs))))
(format "%02d:%02d:%02d"
(/ secint 3600) ;; hours
(/ (% secint 3600) 60) ;; seconds
(% secint 60)))) ;; seconds
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Brendan
PS: comments on my lisp style welcome, as usual.
--
Brendan Halpin, Department of Sociology, University of Limerick, Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-390476; Room F2-025 x 3147
mailto:brendan.halpin@ul.ie http://www.ul.ie/sociology/brendan.halpin.html