unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Brendan Halpin <brendan.halpin@ul.ie>
Subject: Re: reporting using timeclock?
Date: 24 Sep 2003 11:17:53 +0100	[thread overview]
Message-ID: <m33cemv6b2.fsf@wivenhoe.staff8.ul.ie> (raw)
In-Reply-To: u65k1b8ll.fsf@sbc.com

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

      parent reply	other threads:[~2003-09-24 10:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-10  3:54 reporting using timeclock? ASH JAMES
2003-09-10 13:29 ` Glenn Morris
2003-09-24 10:17 ` Brendan Halpin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m33cemv6b2.fsf@wivenhoe.staff8.ul.ie \
    --to=brendan.halpin@ul.ie \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).