• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/calendar/

Lines Matching +refs:timeclock +refs:day +refs:list +refs:projects

0 ;;; timeclock.el --- mode for keeping track of how much you work
32 ;; track of how much time you spend working on certain projects.
34 ;; Use `timeclock-in' when you start on a project, and `timeclock-out'
36 ;; `timeclock-workday-remaining' to see how much time is left to be
37 ;; worked today (where `timeclock-workday' specifies the length of the
38 ;; working day), and `timeclock-when-to-leave' to calculate when you're free.
40 ;; You'll probably want to bind the timeclock commands to some handy
43 ;; (require 'timeclock)
45 ;; (define-key ctl-x-map "ti" 'timeclock-in)
46 ;; (define-key ctl-x-map "to" 'timeclock-out)
47 ;; (define-key ctl-x-map "tc" 'timeclock-change)
48 ;; (define-key ctl-x-map "tr" 'timeclock-reread-log)
49 ;; (define-key ctl-x-map "tu" 'timeclock-update-modeline)
50 ;; (define-key ctl-x-map "tw" 'timeclock-when-to-leave-string)
54 ;; `timeclock-modeline-display' to t using M-x customize, or you
57 ;; (require 'timeclock)
58 ;; (timeclock-modeline-display)
61 ;; `timeclock-modeline-display' again.
65 ;; `timeclock-ask-before-exiting' to t using M-x customize (this is
68 ;; (add-hook 'kill-emacs-query-functions 'timeclock-query-out)
70 ;; NOTE: If you change your .timelog file without using timeclock's
71 ;; functions, or if you change the value of any of timeclock's
73 ;; `timeclock-reread-log'. This will recompute any discrepancies in
81 (defgroup timeclock nil
87 (defcustom timeclock-file (convert-standard-filename "~/.timelog")
88 "*The file used to store timeclock data in."
90 :group 'timeclock)
92 (defcustom timeclock-workday (* 8 60 60)
95 :group 'timeclock)
97 (defcustom timeclock-relative t
98 "*Whether to make reported time relative to `timeclock-workday'.
104 previous days. This only affects the timeclock modeline display."
106 :group 'timeclock)
108 (defcustom timeclock-get-project-function 'timeclock-ask-for-project
114 :group 'timeclock)
116 (defcustom timeclock-get-reason-function 'timeclock-ask-for-reason
122 :group 'timeclock)
124 (defcustom timeclock-get-workday-function nil
126 The first time that a user clocks in each day, this function will be
128 the return value is nil, or equal to `timeclock-workday', nothing special
129 will be done. If it is a quantity different from `timeclock-workday',
131 that day has a length that is different from the norm."
133 :group 'timeclock)
135 (defcustom timeclock-ask-before-exiting t
140 (add-hook 'kill-emacs-query-functions 'timeclock-query-out)
141 (remove-hook 'kill-emacs-query-functions 'timeclock-query-out))
142 (setq timeclock-ask-before-exiting value))
144 :group 'timeclock)
146 (defvar timeclock-update-timer nil
147 "The timer used to update `timeclock-mode-string'.")
151 (defvar timeclock-modeline-display)
153 (defcustom timeclock-use-display-time t
160 while timeclock information is being displayed in the modeline has no
161 effect. You should call the function `timeclock-modeline-display' with
165 (and (boundp 'timeclock-modeline-display)
166 timeclock-modeline-display)))
168 ;; `timeclock-modeline-display' is already using, don't
170 ;; of timeclock.el.
174 (memq 'timeclock-update-modeline
177 timeclock-update-timer)))
180 (set-variable 'timeclock-modeline-display nil))
181 (setq timeclock-use-display-time value)
183 (set-variable 'timeclock-modeline-display t))
184 timeclock-use-display-time))
186 :group 'timeclock
189 (defcustom timeclock-first-in-hook nil
190 "*A hook run for the first \"in\" event each day.
192 value of `timeclock-hours-today', `timeclock-last-event' and the
193 return value of function `timeclock-last-period' are relative previous
196 :group 'timeclock)
198 (defcustom timeclock-load-hook nil
199 "*Hook that gets run after timeclock has been loaded."
201 :group 'timeclock)
203 (defcustom timeclock-in-hook nil
206 :group 'timeclock)
208 (defcustom timeclock-day-over-hook nil
211 in the modeline. See the variable `timeclock-modeline-display'."
213 :group 'timeclock)
215 (defcustom timeclock-out-hook nil
218 :group 'timeclock)
220 (defcustom timeclock-done-hook nil
223 :group 'timeclock)
225 (defcustom timeclock-event-hook nil
228 :group 'timeclock)
230 (defvar timeclock-last-event nil
231 "A list containing the last event that was recorded.
232 The format of this list is (CODE TIME PROJECT).")
234 (defvar timeclock-last-event-workday nil
235 "The number of seconds in the workday of `timeclock-last-event'.")
239 (defvar timeclock-discrepancy nil
241 Normally, timeclock assumes that you intend to work for
242 `timeclock-workday' seconds every day. Any days in which you work
246 definition have worked an average amount equal to `timeclock-workday'
247 each day.")
249 (defvar timeclock-elapsed nil
252 call `timeclock-workday-elapsed', to determine how much time has been
253 worked so far today. Also, if `timeclock-relative' is nil, this value
254 will be the same as `timeclock-discrepancy'.")
256 (defvar timeclock-use-elapsed nil
259 (defvar timeclock-last-period nil
262 function `timeclock-last-period'.")
264 (defvar timeclock-mode-string nil
265 "The timeclock string (optionally) displayed in the modeline.
268 (defvar timeclock-day-over nil
269 "The date of the last day when notified \"day over\" for.")
274 (defun timeclock-modeline-display (&optional arg)
276 If `timeclock-use-display-time' is non-nil (the default), then
279 the timeclock will use its own sixty second timer to do its
281 if ARG is positive. Returns the new status of timeclock modeline
285 (setq timeclock-mode-string "")
289 (not timeclock-modeline-display))))
292 (or (memq 'timeclock-mode-string global-mode-string)
294 (append global-mode-string '(timeclock-mode-string))))
295 (unless (memq 'timeclock-update-modeline timeclock-event-hook)
296 (add-hook 'timeclock-event-hook 'timeclock-update-modeline))
297 (when timeclock-update-timer
298 (cancel-timer timeclock-update-timer)
299 (setq timeclock-update-timer nil))
301 (remove-hook 'display-time-hook 'timeclock-update-modeline))
302 (if timeclock-use-display-time
306 (if display-time-mode (timeclock-update-modeline)
308 timeclock information"))
309 (add-hook 'display-time-hook 'timeclock-update-modeline))
310 (setq timeclock-update-timer
311 (run-at-time nil 60 'timeclock-update-modeline))))
313 (delq 'timeclock-mode-string global-mode-string))
314 (remove-hook 'timeclock-event-hook 'timeclock-update-modeline)
317 'timeclock-update-modeline))
318 (when timeclock-update-timer
319 (cancel-timer timeclock-update-timer)
320 (setq timeclock-update-timer nil)))
322 (setq timeclock-modeline-display on-p)))
325 ;; `timeclock-modeline-display' is known to the "set" function.
326 (defcustom timeclock-modeline-display nil
330 (setq timeclock-modeline-display
331 (timeclock-modeline-display (or value 0))))
333 :group 'timeclock
334 :require 'timeclock)
336 (defsubst timeclock-time-to-date (time)
341 (defun timeclock-in (&optional arg project find-project)
348 this function is called within a day.
351 FIND-PROJECT is non-nil -- or the user calls `timeclock-in'
352 interactively -- call the function `timeclock-get-project-function' to
355 (list (and current-prefix-arg
359 (if (equal (car timeclock-last-event) "i")
361 (unless timeclock-last-event
362 (timeclock-reread-log))
363 ;; Either no log file, or day has rolled over.
364 (unless (and timeclock-last-event
365 (equal (timeclock-time-to-date
366 (cadr timeclock-last-event))
367 (timeclock-time-to-date (current-time))))
370 (and timeclock-get-workday-function
371 (funcall timeclock-get-workday-function))
372 timeclock-workday)))
373 (run-hooks 'timeclock-first-in-hook)
374 ;; settle the discrepancy for the new day
375 (setq timeclock-discrepancy
376 (- (or timeclock-discrepancy 0) workday))
377 (if (not (= workday timeclock-workday))
378 (timeclock-log "h" (number-to-string
381 (timeclock-log "i" (or project
382 (and timeclock-get-project-function
384 (funcall timeclock-get-project-function))))
385 (run-hooks 'timeclock-in-hook)))
388 (defun timeclock-out (&optional arg reason find-reason)
394 FIND-REASON is non-nil -- or the user calls `timeclock-out'
395 interactively -- call the function `timeclock-get-reason-function' to
398 (or timeclock-last-event
400 (if (equal (downcase (car timeclock-last-event)) "o")
402 (timeclock-log
405 (and timeclock-get-reason-function
407 (funcall timeclock-get-reason-function))))
408 (run-hooks 'timeclock-out-hook)
410 (run-hooks 'timeclock-done-hook))))
412 ;; Should today-only be removed in favour of timeclock-relative? - gm
413 (defsubst timeclock-workday-remaining (&optional today-only)
415 The amount returned is relative to the value of `timeclock-workday'.
418 (let ((discrep (timeclock-find-discrep)))
425 (defun timeclock-status-string (&optional show-seconds today-only)
426 "Report the overall timeclock status at the present moment.
431 (let ((remainder (timeclock-workday-remaining
433 (not timeclock-relative))))
434 (last-in (equal (car timeclock-last-event) "i"))
441 (nth 1 timeclock-last-event))
443 (nth 1 timeclock-last-event)))
444 (or (nth 2 timeclock-last-event)
446 (timeclock-seconds-to-string remainder show-seconds t)
449 (timeclock-when-to-leave-string show-seconds today-only)))
455 (defun timeclock-change (&optional arg project)
462 (timeclock-out arg)
463 (timeclock-in nil project (interactive-p)))
466 (defun timeclock-query-out ()
469 (and (equal (car timeclock-last-event) "i")
471 (timeclock-out))
476 (defun timeclock-reread-log ()
477 "Re-read the timeclock, to account for external changes.
478 Returns the new value of `timeclock-discrepancy'."
480 (setq timeclock-discrepancy nil)
481 (timeclock-find-discrep)
482 (if (and timeclock-discrepancy timeclock-modeline-display)
483 (timeclock-update-modeline))
484 timeclock-discrepancy)
486 (defun timeclock-seconds-to-string (seconds &optional show-seconds
505 (defsubst timeclock-currently-in-p ()
507 (equal (car timeclock-last-event) "i"))
510 (defun timeclock-workday-remaining-string (&optional show-seconds
515 See `timeclock-relative' for more information about the meaning of
518 (let ((string (timeclock-seconds-to-string
519 (timeclock-workday-remaining today-only)
525 (defsubst timeclock-workday-elapsed ()
530 (let ((discrep (timeclock-find-discrep)))
536 (defun timeclock-workday-elapsed-string (&optional show-seconds)
541 (let ((string (timeclock-seconds-to-string (timeclock-workday-elapsed)
547 (defsubst timeclock-time-to-seconds (time)
553 (defsubst timeclock-seconds-to-time (seconds)
555 (list (floor seconds 65536)
559 ;; Should today-only be removed in favour of timeclock-relative? - gm
560 (defsubst timeclock-when-to-leave (&optional today-only)
564 (timeclock-seconds-to-time
565 (- (timeclock-time-to-seconds (current-time))
566 (let ((discrep (timeclock-find-discrep)))
574 (defun timeclock-when-to-leave-string (&optional show-seconds
577 This string is relative to the value of `timeclock-workday'. If
581 ;; Should today-only be removed in favour of timeclock-relative? - gm
583 (let* ((then (timeclock-when-to-leave today-only))
594 (defvar timeclock-project-list nil)
595 (defvar timeclock-last-project nil)
597 (defun timeclock-completing-read (prompt alist &optional default)
606 (defun timeclock-ask-for-project ()
608 (timeclock-completing-read
610 (or timeclock-last-project
611 (car timeclock-project-list)))
612 (mapcar 'list timeclock-project-list)
613 (or timeclock-last-project
614 (car timeclock-project-list))))
616 (defvar timeclock-reason-list nil)
618 (defun timeclock-ask-for-reason ()
620 (timeclock-completing-read "Reason for clocking out: "
621 (mapcar 'list timeclock-reason-list)))
623 (defun timeclock-update-modeline ()
624 "Update the `timeclock-mode-string' displayed in the modeline.
625 The value of `timeclock-relative' affects the display as described in
629 (if timeclock-use-elapsed
630 (timeclock-workday-elapsed)
631 (timeclock-workday-remaining (not timeclock-relative))))
632 (last-in (equal (car timeclock-last-event) "i")))
634 (not (and timeclock-day-over
635 (equal timeclock-day-over
636 (timeclock-time-to-date
638 (setq timeclock-day-over
639 (timeclock-time-to-date (current-time)))
640 (run-hooks 'timeclock-day-over-hook))
641 (setq timeclock-mode-string
645 (timeclock-seconds-to-string remainder nil t)
647 'help-echo "timeclock: time remaining"))))
649 (put 'timeclock-mode-string 'risky-local-variable t)
651 (defun timeclock-log (code &optional project)
652 "Log the event CODE to the timeclock log, at the time of call.
655 (let ((extant-timelog (find-buffer-visiting timeclock-file)))
656 (with-current-buffer (find-file-noselect timeclock-file)
673 (setq timeclock-last-period
674 (- (timeclock-time-to-seconds now)
675 (timeclock-time-to-seconds
676 (cadr timeclock-last-event)))
677 timeclock-discrepancy
678 (+ timeclock-discrepancy
679 timeclock-last-period)))
680 (setq timeclock-last-event (list code now project)))))
682 (run-hooks 'timeclock-event-hook)
685 (defvar timeclock-moment-regexp
690 (defsubst timeclock-read-moment ()
692 (if (looking-at timeclock-moment-regexp)
701 (list code (encode-time sec min hour mday mon year) project))))
703 (defun timeclock-last-period (&optional moment)
709 `timeclock-discrepancy'."
710 (if (equal (car timeclock-last-event) "i")
711 (- (timeclock-time-to-seconds (or moment (current-time)))
712 (timeclock-time-to-seconds
713 (cadr timeclock-last-event)))
714 timeclock-last-period))
716 (defsubst timeclock-entry-length (entry)
717 (- (timeclock-time-to-seconds (cadr entry))
718 (timeclock-time-to-seconds (car entry))))
720 (defsubst timeclock-entry-begin (entry)
723 (defsubst timeclock-entry-end (entry)
726 (defsubst timeclock-entry-project (entry)
729 (defsubst timeclock-entry-comment (entry)
733 (defsubst timeclock-entry-list-length (entry-list)
735 (while entry-list
736 (setq length (+ length (timeclock-entry-length (car entry-list))))
737 (setq entry-list (cdr entry-list)))
740 (defsubst timeclock-entry-list-begin (entry-list)
741 (timeclock-entry-begin (car entry-list)))
743 (defsubst timeclock-entry-list-end (entry-list)
744 (timeclock-entry-end (car (last entry-list))))
746 (defsubst timeclock-entry-list-span (entry-list)
747 (- (timeclock-time-to-seconds (timeclock-entry-list-end entry-list))
748 (timeclock-time-to-seconds (timeclock-entry-list-begin entry-list))))
750 (defsubst timeclock-entry-list-break (entry-list)
751 (- (timeclock-entry-list-span entry-list)
752 (timeclock-entry-list-length entry-list)))
754 (defsubst timeclock-entry-list-projects (entry-list)
755 (let (projects)
756 (while entry-list
757 (let ((project (timeclock-entry-project (car entry-list))))
758 (if projects
759 (add-to-list 'projects project)
760 (setq projects (list project))))
761 (setq entry-list (cdr entry-list)))
762 projects))
765 (defsubst timeclock-day-required (day)
766 (or (car day) timeclock-workday))
768 (defsubst timeclock-day-length (day)
769 (timeclock-entry-list-length (cdr day)))
771 (defsubst timeclock-day-debt (day)
772 (- (timeclock-day-required day)
773 (timeclock-day-length day)))
775 (defsubst timeclock-day-begin (day)
776 (timeclock-entry-list-begin (cdr day)))
778 (defsubst timeclock-day-end (day)
779 (timeclock-entry-list-end (cdr day)))
781 (defsubst timeclock-day-span (day)
782 (timeclock-entry-list-span (cdr day)))
784 (defsubst timeclock-day-break (day)
785 (timeclock-entry-list-break (cdr day)))
787 (defsubst timeclock-day-projects (day)
788 (timeclock-entry-list-projects (cdr day)))
790 (defmacro timeclock-day-list-template (func)
792 (while day-list
793 (setq length (+ length (,(eval func) (car day-list))))
794 (setq day-list (cdr day-list)))
797 (defun timeclock-day-list-required (day-list)
798 (timeclock-day-list-template 'timeclock-day-required))
800 (defun timeclock-day-list-length (day-list)
801 (timeclock-day-list-template 'timeclock-day-length))
803 (defun timeclock-day-list-debt (day-list)
804 (timeclock-day-list-template 'timeclock-day-debt))
806 (defsubst timeclock-day-list-begin (day-list)
807 (timeclock-day-begin (car day-list)))
809 (defsubst timeclock-day-list-end (day-list)
810 (timeclock-day-end (car (last day-list))))
812 (defun timeclock-day-list-span (day-list)
813 (timeclock-day-list-template 'timeclock-day-span))
815 (defun timeclock-day-list-break (day-list)
816 (timeclock-day-list-template 'timeclock-day-break))
818 (defun timeclock-day-list-projects (day-list)
819 (let (projects)
820 (while day-list
821 (let ((projs (timeclock-day-projects (car day-list))))
823 (if projects
824 (add-to-list 'projects (car projs))
825 (setq projects (list (car projs))))
827 (setq day-list (cdr day-list)))
828 projects))
831 (defsubst timeclock-current-debt (&optional log-data)
832 (nth 0 (or log-data (timeclock-log-data))))
834 (defsubst timeclock-day-alist (&optional log-data)
835 (nth 1 (or log-data (timeclock-log-data))))
837 (defun timeclock-day-list (&optional log-data)
838 (let ((alist (timeclock-day-alist log-data))
839 day-list)
841 (setq day-list (cons (cdar alist) day-list)
843 day-list))
845 (defsubst timeclock-project-alist (&optional log-data)
846 (nth 2 (or log-data (timeclock-log-data))))
849 (defun timeclock-log-data (&optional recent-only filename)
854 the file specified by `timeclock-file.'
868 h Set the required working time for the given day. This must
869 be the first entry for that day. The COMMENT in this case is
892 where the CAR is the index, and the CDR is a list of time entries.
903 list of TIME-ENTRIES. Note that if DAY-LENGTH is nil, it means
913 the user is expected to manipulate to the day(s) or project(s) that he
917 timeclock-day-required
918 timeclock-day-length
919 timeclock-day-debt
920 timeclock-day-begin
921 timeclock-day-end
922 timeclock-day-span
923 timeclock-day-break
924 timeclock-day-projects
926 timeclock-day-list-required
927 timeclock-day-list-length
928 timeclock-day-list-debt
929 timeclock-day-list-begin
930 timeclock-day-list-end
931 timeclock-day-list-span
932 timeclock-day-list-break
933 timeclock-day-list-projects
935 timeclock-entry-length
936 timeclock-entry-begin
937 timeclock-entry-end
938 timeclock-entry-project
939 timeclock-entry-comment
941 timeclock-entry-list-length
942 timeclock-entry-list-begin
943 timeclock-entry-list-end
944 timeclock-entry-list-span
945 timeclock-entry-list-break
946 timeclock-entry-list-projects
950 `required' is the amount of time that must be spent during a day, or
966 `project' is the project that was worked on, and `projects' is a
967 list of all the projects that were worked on during a given period.
971 There are a few more functions available, for locating day and entry
974 timeclock-day-alist LOG-DATA
975 timeclock-project-alist LOG-DATA
976 timeclock-current-debt LOG-DATA
979 (let* ((log-data (list 0.0 nil nil))
981 (todays-date (timeclock-time-to-date now))
983 (line 0) last beg day entry event)
985 (insert-file-contents (or filename timeclock-file))
990 (while (or (setq event (timeclock-read-moment))
992 (setq last t event (list "o" now))))
997 (setq last-date-limited (timeclock-time-to-date (cadr event))
1004 (setq entry (list (cadr event) nil
1007 (let ((date (timeclock-time-to-date (cadr event))))
1012 (cons (cons last-date day)
1014 (setq day (list (and last-date-limited
1016 (unless day
1017 (setq day (list (and last-date-limited
1029 (nconc entry (list (nth 2 event))))
1032 (list t)
1033 (list nil t))))
1034 (nconc day (list entry))
1039 (cons (cons desc (list entry))
1041 (nconc (cdr proj) (list entry)))))))
1043 (if day
1045 (cons (cons last-date day)
1049 (defun timeclock-find-discrep ()
1051 The result is a three element list, containing the total time
1059 ;; (let ((days (timeclock-day-alist (timeclock-log-data)))
1062 ;; (setq total (+ total (- (timeclock-day-length (cdar days))
1063 ;; (timeclock-day-required (cdar days))))
1067 (todays-date (timeclock-time-to-date now))
1071 (unless timeclock-discrepancy
1072 (when (file-readable-p timeclock-file)
1073 (setq timeclock-project-list nil
1074 timeclock-last-project nil
1075 timeclock-reason-list nil
1076 timeclock-elapsed 0)
1078 (insert-file-contents timeclock-file)
1082 (while (setq event (timeclock-read-moment))
1087 (timeclock-time-to-date (cadr event))
1093 (add-to-list 'timeclock-project-list (nth 2 event))
1094 (setq timeclock-last-project (nth 2 event)))
1095 (let ((date (timeclock-time-to-date (cadr event))))
1102 timeclock-workday))))
1107 (setq beg (timeclock-time-to-seconds (cadr event))))))
1111 (add-to-list 'timeclock-reason-list (nth 2 event)))
1114 (setq timeclock-last-period
1115 (- (timeclock-time-to-seconds (cadr event)) beg)
1116 accum (+ timeclock-last-period accum)
1119 (setq timeclock-elapsed
1120 (+ timeclock-last-period timeclock-elapsed)))))
1121 (setq timeclock-last-event event
1122 timeclock-last-event-workday
1123 (if (equal (timeclock-time-to-date now) last-date-limited)
1125 timeclock-workday))
1127 (setq timeclock-discrepancy accum))))
1128 (unless timeclock-last-event-workday
1129 (setq timeclock-last-event-workday timeclock-workday))
1130 (setq accum (or timeclock-discrepancy 0)
1131 elapsed (or timeclock-elapsed elapsed))
1132 (if timeclock-last-event
1133 (if (equal (car timeclock-last-event) "i")
1134 (let ((last-period (timeclock-last-period now)))
1137 (if (not (equal (timeclock-time-to-date
1138 (cadr timeclock-last-event))
1139 (timeclock-time-to-date now)))
1140 (setq accum (- accum timeclock-last-event-workday)))))
1141 (list accum (- elapsed timeclock-last-event-workday)
1144 ;;; A reporting function that uses timeclock-log-data
1146 (defun timeclock-day-base (&optional time)
1147 "Given a time within a day, return 0:0:0 within that day.
1155 (defun timeclock-geometric-mean (l)
1156 "Compute the geometric mean of the values in the list L."
1167 (defun timeclock-generate-report (&optional html-p)
1172 (let ((log (timeclock-log-data))
1173 (today (timeclock-day-base)))
1176 (let ((project (nth 2 timeclock-last-event))
1177 (begin (nth 1 timeclock-last-event))
1179 (if (timeclock-currently-in-p)
1190 (if (timeclock-currently-in-p)
1195 (let ((proj-data (cdr (assoc project (timeclock-project-alist log))))
1196 (two-weeks-ago (timeclock-seconds-to-time
1197 (- (timeclock-time-to-seconds today)
1202 (timeclock-entry-begin (car proj-data)) today))
1203 (setq today-len (timeclock-entry-list-length proj-data)
1207 (timeclock-entry-begin (car proj-data))
1209 (setq two-week-len (timeclock-entry-list-length proj-data)))
1216 (timeclock-seconds-to-string today-len)
1218 (timeclock-seconds-to-string two-week-len))
1221 (timeclock-seconds-to-string two-week-len))))
1224 (timeclock-seconds-to-string (timeclock-workday-elapsed))
1226 (timeclock-seconds-to-string (timeclock-workday-remaining))
1228 (timeclock-when-to-leave-string) "\n")))
1232 (length (timeclock-day-alist log)))
1234 (caar (last (timeclock-day-alist log))))
1248 (let* ((day-list (timeclock-day-list))
1249 (thirty-days-ago (timeclock-seconds-to-time
1250 (- (timeclock-time-to-seconds today)
1252 (three-months-ago (timeclock-seconds-to-time
1253 (- (timeclock-time-to-seconds today)
1255 (six-months-ago (timeclock-seconds-to-time
1256 (- (timeclock-time-to-seconds today)
1258 (one-year-ago (timeclock-seconds-to-time
1259 (- (timeclock-time-to-seconds today)
1261 (time-in (vector (list t) (list t) (list t) (list t) (list t)))
1262 (time-out (vector (list t) (list t) (list t) (list t) (list t)))
1263 (breaks (vector (list t) (list t) (list t) (list t) (list t)))
1264 (workday (vector (list t) (list t) (list t) (list t) (list t)))
1268 (while day-list
1272 (timeclock-day-begin (car day-list))
1274 (let ((base (timeclock-time-to-seconds
1275 (timeclock-day-base
1276 (timeclock-day-begin (car day-list))))))
1278 (list (- (timeclock-time-to-seconds
1279 (timeclock-day-begin (car day-list)))
1281 (let ((span (timeclock-day-span (car day-list)))
1282 (len (timeclock-day-length (car day-list)))
1283 (req (timeclock-day-required (car day-list))))
1284 ;; If the day's actual work length is less than
1291 (list (- (timeclock-time-to-seconds
1292 (timeclock-day-end (car day-list)))
1294 (nconc (aref breaks i) (list (- span len))))
1296 (setq len (+ len (- timeclock-workday req))))
1297 (nconc (aref workday i) (list len)))))
1299 (setq day-list (cdr day-list)))
1303 (aset time-in i (timeclock-geometric-mean
1305 (aset time-out i (timeclock-geometric-mean
1307 (aset breaks i (timeclock-geometric-mean
1309 (aset workday i (timeclock-geometric-mean
1318 (timeclock-seconds-to-string (aref time-in i))
1328 (timeclock-seconds-to-string (aref time-out i))
1338 (timeclock-seconds-to-string (aref breaks i))
1348 (timeclock-seconds-to-string (aref workday i))
1361 (defun timeclock-visit-timelog ()
1362 "Open the file named by `timeclock-file' in another window."
1364 (find-file-other-window timeclock-file))
1366 (provide 'timeclock)
1368 (run-hooks 'timeclock-load-hook)
1370 ;; make sure we know the list of reasons, projects, and have computed
1372 (if (file-readable-p timeclock-file)
1373 (timeclock-reread-log))
1376 ;;; timeclock.el ends here