summaryrefslogtreecommitdiff
path: root/lisp/calendar/timeclock.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-02-10 20:25:22 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-02-10 23:54:35 -0800
commit988e37fa0f922b852715671d59a0e3f682373411 (patch)
tree6520da61ebe5a27b3057bfb97eaa83053bf8eeec /lisp/calendar/timeclock.el
parent3eb63da19579824801a169a03b9de7bdd945eaa6 (diff)
downloademacs-988e37fa0f922b852715671d59a0e3f682373411.tar.gz
Simplify use of encode-time
Most uses of (apply #'encode-time foo) can now be replaced with (encode-time foo). Make similar simplifications. * lisp/calendar/time-date.el (date-to-time): * lisp/calendar/timeclock.el (timeclock-when-to-leave) (timeclock-day-base, timeclock-generate-report): * lisp/emacs-lisp/timer.el (timer-set-idle-time): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/gnus/gnus-art.el (article-make-date-line): * lisp/gnus/gnus-delay.el (gnus-delay-article) (gnus-delay-send-queue): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--decode-datefield): * lisp/gnus/gnus-logic.el (gnus-advanced-date): * lisp/gnus/message.el (message-make-expires-date): * lisp/gnus/nndiary.el (nndiary-compute-reminders): * lisp/mail/ietf-drums.el (ietf-drums-parse-date): * lisp/net/tramp-adb.el (tramp-adb-ls-output-time-less-p): * lisp/org/org-agenda.el (org-agenda-get-timestamps) (org-agenda-get-progress, org-agenda-show-clocking-issues): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-get-sum-start, org-clock-sum) (org-clocktable-steps): * lisp/org/org-colview.el (org-colview-construct-allowed-dates) * lisp/org/org-macro.el (org-macro--vc-modified-time): * lisp/org/org-table.el (org-table-eval-formula): * lisp/org/org.el (org-current-time, org-store-link) (org-time-today, org-read-date, org-read-date-display) (org-display-custom-time, org-time-string-to-time) (org-timestamp-change, org-timestamp--to-internal-time): * lisp/url/url-dav.el (url-dav-process-date-property): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time) (vc-cvs-parse-entry): Simplify use of encode-time. * lisp/org/org-clock.el (org-clock-get-clocked-time): (org-clock-resolve, org-resolve-clocks, org_clock_out) (org-clock-update-time-maybe): Avoid some rounding problems with encode-time and float-time. * lisp/org/org-clock.el (org-clock-in, org-clock-update-time-maybe): * lisp/org/org-colview.el (org-columns--age-to-minutes): * lisp/org/org.el (org-get-scheduled-time, org-get-deadline-time) (org-add-planning-info, org-2ft, org-time-string-to-absolute) (org-closest-date): Use org-time-string-to-time instead of doing it by hand with encode-time. * lisp/org/org.el (org-current-time): Simplify rounding. (org-read-date): Avoid extra trip through encode-time.
Diffstat (limited to 'lisp/calendar/timeclock.el')
-rw-r--r--lisp/calendar/timeclock.el37
1 files changed, 13 insertions, 24 deletions
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index fd6f5310c8d..5c3580dd848 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -528,14 +528,13 @@ non-nil, the amount returned will be relative to past time worked."
"Return a time value representing the end of today's workday.
If TODAY-ONLY is non-nil, the value returned will be relative only to
the time worked today, and not to past time."
- (encode-time
- (- (float-time)
- (let ((discrep (timeclock-find-discrep)))
- (if discrep
- (if today-only
- (cadr discrep)
- (car discrep))
- 0.0)))))
+ (time-subtract nil
+ (let ((discrep (timeclock-find-discrep)))
+ (if discrep
+ (if today-only
+ (cadr discrep)
+ (car discrep))
+ 0))))
;;;###autoload
(defun timeclock-when-to-leave-string (&optional show-seconds
@@ -1156,7 +1155,7 @@ If optional argument TIME is non-nil, use that instead of the current time."
(setcar (nthcdr 0 decoded) 0)
(setcar (nthcdr 1 decoded) 0)
(setcar (nthcdr 2 decoded) 0)
- (apply 'encode-time decoded)))
+ (encode-time decoded)))
(defun timeclock-mean (l)
"Compute the arithmetic mean of the values in the list L."
@@ -1196,9 +1195,7 @@ HTML-P is non-nil, HTML markup is added."
(insert project "</b><br>\n")
(insert project "*\n"))
(let ((proj-data (cdr (assoc project (timeclock-project-alist log))))
- (two-weeks-ago (encode-time
- (- (float-time today)
- (* 2 7 24 60 60))))
+ (two-weeks-ago (time-subtract today (* 2 7 24 60 60)))
two-week-len today-len)
(while proj-data
(if (not (time-less-p
@@ -1249,18 +1246,10 @@ HTML-P is non-nil, HTML markup is added."
<th>-1 year</th>
</tr>")
(let* ((day-list (timeclock-day-list))
- (thirty-days-ago (encode-time
- (- (float-time today)
- (* 30 24 60 60))))
- (three-months-ago (encode-time
- (- (float-time today)
- (* 90 24 60 60))))
- (six-months-ago (encode-time
- (- (float-time today)
- (* 180 24 60 60))))
- (one-year-ago (encode-time
- (- (float-time today)
- (* 365 24 60 60))))
+ (thirty-days-ago (time-subtract today (* 30 24 60 60)))
+ (three-months-ago (time-subtract today (* 90 24 60 60)))
+ (six-months-ago (time-subtract today (* 180 24 60 60)))
+ (one-year-ago (time-subtract today (* 365 24 60 60)))
(time-in (vector (list t) (list t) (list t) (list t) (list t)))
(time-out (vector (list t) (list t) (list t) (list t) (list t)))
(breaks (vector (list t) (list t) (list t) (list t) (list t)))