diff options
| -rw-r--r-- | lisp/calendar/timeclock.el | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index fb4a4c1afcd..49a22d3ea14 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el | |||
| @@ -548,7 +548,7 @@ non-nil, the amount returned will be relative to past time worked." | |||
| 548 | "Convert TIME to a floating point number." | 548 | "Convert TIME to a floating point number." |
| 549 | (+ (* (car time) 65536.0) | 549 | (+ (* (car time) 65536.0) |
| 550 | (cadr time) | 550 | (cadr time) |
| 551 | (/ (or (car (cdr (cdr time))) 0) 1000000.0))) | 551 | (/ (or (nth 2 time) 0) 1000000.0))) |
| 552 | 552 | ||
| 553 | (defsubst timeclock-seconds-to-time (seconds) | 553 | (defsubst timeclock-seconds-to-time (seconds) |
| 554 | "Convert SECONDS (a floating point number) to an Emacs time structure." | 554 | "Convert SECONDS (a floating point number) to an Emacs time structure." |
| @@ -632,7 +632,7 @@ PROMPT, ALIST and DEFAULT are used for the PROMPT, COLLECTION and DEF | |||
| 632 | arguments of `completing-read'." | 632 | arguments of `completing-read'." |
| 633 | (if (featurep 'xemacs) | 633 | (if (featurep 'xemacs) |
| 634 | (let ((str (completing-read prompt alist))) | 634 | (let ((str (completing-read prompt alist))) |
| 635 | (if (or (null str) (= (length str) 0)) | 635 | (if (or (null str) (zerop (length str))) |
| 636 | default | 636 | default |
| 637 | str)) | 637 | str)) |
| 638 | (completing-read prompt alist nil nil nil nil default))) | 638 | (completing-read prompt alist nil nil nil nil default))) |
| @@ -839,8 +839,8 @@ This is only provided for coherency when used by | |||
| 839 | "Template for summing the result of FUNC on each element of DAY-LIST." | 839 | "Template for summing the result of FUNC on each element of DAY-LIST." |
| 840 | `(let ((length 0)) | 840 | `(let ((length 0)) |
| 841 | (while day-list | 841 | (while day-list |
| 842 | (setq length (+ length (,(eval func) (car day-list)))) | 842 | (setq length (+ length (,(eval func) (car day-list))) |
| 843 | (setq day-list (cdr day-list))) | 843 | day-list (cdr day-list))) |
| 844 | length)) | 844 | length)) |
| 845 | 845 | ||
| 846 | (defun timeclock-day-list-required (day-list) | 846 | (defun timeclock-day-list-required (day-list) |
| @@ -1091,7 +1091,7 @@ See the documentation for the given function if more info is needed." | |||
| 1091 | (if (null proj) | 1091 | (if (null proj) |
| 1092 | (setcar (cddr log-data) | 1092 | (setcar (cddr log-data) |
| 1093 | (cons (cons desc (list entry)) | 1093 | (cons (cons desc (list entry)) |
| 1094 | (car (cddr log-data)))) | 1094 | (nth 2 log-data))) |
| 1095 | (nconc (cdr proj) (list entry))))))) | 1095 | (nconc (cdr proj) (list entry))))))) |
| 1096 | (forward-line)) | 1096 | (forward-line)) |
| 1097 | (if day | 1097 | (if day |
| @@ -1210,13 +1210,12 @@ If optional argument TIME is non-nil, use that instead of the current time." | |||
| 1210 | "Compute the arithmetic mean of the values in the list L." | 1210 | "Compute the arithmetic mean of the values in the list L." |
| 1211 | (let ((total 0) | 1211 | (let ((total 0) |
| 1212 | (count 0)) | 1212 | (count 0)) |
| 1213 | (while l | 1213 | (dolist (thisl l) |
| 1214 | (setq total (+ total (car l)) | 1214 | (setq total (+ total thisl) |
| 1215 | count (1+ count) | 1215 | count (1+ count))) |
| 1216 | l (cdr l))) | 1216 | (if (zerop count) |
| 1217 | (if (> count 0) | 1217 | 0 |
| 1218 | (/ total count) | 1218 | (/ total count)))) |
| 1219 | 0))) | ||
| 1220 | 1219 | ||
| 1221 | (defun timeclock-generate-report (&optional html-p) | 1220 | (defun timeclock-generate-report (&optional html-p) |
| 1222 | "Generate a summary report based on the current timelog file. | 1221 | "Generate a summary report based on the current timelog file. |
| @@ -1232,7 +1231,7 @@ HTML-P is non-nil, HTML markup is added." | |||
| 1232 | done) | 1231 | done) |
| 1233 | (if (timeclock-currently-in-p) | 1232 | (if (timeclock-currently-in-p) |
| 1234 | (insert "IN") | 1233 | (insert "IN") |
| 1235 | (if (or (null project) (= (length project) 0)) | 1234 | (if (zerop (length project)) |
| 1236 | (progn (insert "Done Working Today") | 1235 | (progn (insert "Done Working Today") |
| 1237 | (setq done t)) | 1236 | (setq done t)) |
| 1238 | (insert "OUT"))) | 1237 | (insert "OUT"))) |
| @@ -1319,22 +1318,22 @@ HTML-P is non-nil, HTML markup is added." | |||
| 1319 | (lengths (vector '(0 0) thirty-days-ago three-months-ago | 1318 | (lengths (vector '(0 0) thirty-days-ago three-months-ago |
| 1320 | six-months-ago one-year-ago))) | 1319 | six-months-ago one-year-ago))) |
| 1321 | ;; collect statistics from complete timelog | 1320 | ;; collect statistics from complete timelog |
| 1322 | (while day-list | 1321 | (dolist (day day-list) |
| 1323 | (let ((i 0) (l 5)) | 1322 | (let ((i 0) (l 5)) |
| 1324 | (while (< i l) | 1323 | (while (< i l) |
| 1325 | (unless (time-less-p | 1324 | (unless (time-less-p |
| 1326 | (timeclock-day-begin (car day-list)) | 1325 | (timeclock-day-begin day) |
| 1327 | (aref lengths i)) | 1326 | (aref lengths i)) |
| 1328 | (let ((base (timeclock-time-to-seconds | 1327 | (let ((base (timeclock-time-to-seconds |
| 1329 | (timeclock-day-base | 1328 | (timeclock-day-base |
| 1330 | (timeclock-day-begin (car day-list)))))) | 1329 | (timeclock-day-begin day))))) |
| 1331 | (nconc (aref time-in i) | 1330 | (nconc (aref time-in i) |
| 1332 | (list (- (timeclock-time-to-seconds | 1331 | (list (- (timeclock-time-to-seconds |
| 1333 | (timeclock-day-begin (car day-list))) | 1332 | (timeclock-day-begin day)) |
| 1334 | base))) | 1333 | base))) |
| 1335 | (let ((span (timeclock-day-span (car day-list))) | 1334 | (let ((span (timeclock-day-span day)) |
| 1336 | (len (timeclock-day-length (car day-list))) | 1335 | (len (timeclock-day-length day)) |
| 1337 | (req (timeclock-day-required (car day-list)))) | 1336 | (req (timeclock-day-required day))) |
| 1338 | ;; If the day's actual work length is less than | 1337 | ;; If the day's actual work length is less than |
| 1339 | ;; 70% of its span, then likely the exit time | 1338 | ;; 70% of its span, then likely the exit time |
| 1340 | ;; and break amount are not worthwhile adding to | 1339 | ;; and break amount are not worthwhile adding to |
| @@ -1343,14 +1342,13 @@ HTML-P is non-nil, HTML markup is added." | |||
| 1343 | (> (/ (float len) (float span)) 0.70)) | 1342 | (> (/ (float len) (float span)) 0.70)) |
| 1344 | (nconc (aref time-out i) | 1343 | (nconc (aref time-out i) |
| 1345 | (list (- (timeclock-time-to-seconds | 1344 | (list (- (timeclock-time-to-seconds |
| 1346 | (timeclock-day-end (car day-list))) | 1345 | (timeclock-day-end day)) |
| 1347 | base))) | 1346 | base))) |
| 1348 | (nconc (aref breaks i) (list (- span len)))) | 1347 | (nconc (aref breaks i) (list (- span len)))) |
| 1349 | (if req | 1348 | (if req |
| 1350 | (setq len (+ len (- timeclock-workday req)))) | 1349 | (setq len (+ len (- timeclock-workday req)))) |
| 1351 | (nconc (aref workday i) (list len))))) | 1350 | (nconc (aref workday i) (list len))))) |
| 1352 | (setq i (1+ i)))) | 1351 | (setq i (1+ i))))) |
| 1353 | (setq day-list (cdr day-list))) | ||
| 1354 | ;; average statistics | 1352 | ;; average statistics |
| 1355 | (let ((i 0) (l 5)) | 1353 | (let ((i 0) (l 5)) |
| 1356 | (while (< i l) | 1354 | (while (< i l) |