summaryrefslogtreecommitdiff
path: root/lisp/org/org-clock.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-05-08 12:46:00 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2016-05-08 12:46:22 -0700
commite2f785991d0c696fbb2bc2f331f888d979b8da82 (patch)
treeba345e8547f4542bfe9bbb9ef311405bd519cd97 /lisp/org/org-clock.el
parent2eb6817ba971184cc109f8530f4b3b38f65650ea (diff)
downloademacs-e2f785991d0c696fbb2bc2f331f888d979b8da82.tar.gz
Simplify now that float-time etc. are built-in
This was prompted by warnings about calls to now-obsolete functions. * lisp/calendar/time-date.el (encode-time-value): Use setq rather than a recursive call, to avoid a warning about calling this obsolete function. * lisp/calendar/time-date.el (encode-time-value) (with-decoded-time-value, time-to-seconds, time-to-number-of-days): * lisp/erc/erc.el (erc-emacs-time-to-erc-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Simplify now that time-add and float-time are now built-in. * lisp/calendar/time-date.el (time-add, time-subtract, time-less-p): * lisp/net/newst-backend.el (time-add): * lisp/org/org.el (time-subtract): Remove backward-compatibility definitions; they are now built-in. * lisp/calendar/timeclock.el (timeclock-time-to-seconds) (timeclock-seconds-to-time): * lisp/net/rcirc.el (rcirc-float-time): * lisp/org/org-compat.el (org-float-time): Now obsolete, since callers can just use float-time and seconds-to-time. All uses changed. * lisp/emacs-lisp/ert.el (ert-results-pop-to-timings): * lisp/gnus/gnus-art.el (article-lapsed-string): * lisp/gnus/gnus-diary.el (gnus-user-format-function-d): * lisp/gnus/gnus-group.el (gnus-group-timestamp-delta): * lisp/gnus/nndiary.el (nndiary-compute-reminders): * lisp/net/tramp.el (tramp-time-diff): * lisp/org/org-clock.el (org-clock-timestamps-change): Prefer the time-subtract builtin to the subtract-time alias. * lisp/files.el (dir-locals-find-file, dir-locals-read-from-dir): * test/lisp/character-fold-tests.el (character-fold--speed-test): Prefer the float-time builtin to the time-to-seconds alias. * lisp/org/org-agenda.el, lisp/org/org-clock.el, lisp/org/org-list.el: * lisp/org/org-timer.el, lisp/org/org.el: Adjust to org-float-time deprecation.
Diffstat (limited to 'lisp/org/org-clock.el')
-rw-r--r--lisp/org/org-clock.el58
1 files changed, 29 insertions, 29 deletions
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 9374f5fc3a3..1ec17f4daa1 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -658,8 +658,8 @@ If not, show simply the clocked time like 01:50."
The time returned includes the time spent on this task in
previous clocking intervals."
(let ((currently-clocked-time
- (floor (- (org-float-time)
- (org-float-time org-clock-start-time)) 60)))
+ (floor (- (float-time)
+ (float-time org-clock-start-time)) 60)))
(+ currently-clocked-time (or org-clock-total-time 0))))
(defun org-clock-modify-effort-estimate (&optional value)
@@ -978,7 +978,7 @@ to be CLOCKED OUT."))))
nil 45)))
(and (not (memq char-pressed '(?i ?q))) char-pressed)))))
(default
- (floor (/ (org-float-time
+ (floor (/ (float-time
(time-subtract (current-time) last-valid)) 60)))
(keep
(and (memq ch '(?k ?K))
@@ -987,8 +987,8 @@ to be CLOCKED OUT."))))
(and (memq ch '(?g ?G))
(read-number "Got back how many minutes ago? " default)))
(subtractp (memq ch '(?s ?S)))
- (barely-started-p (< (- (org-float-time last-valid)
- (org-float-time (cdr clock))) 45))
+ (barely-started-p (< (- (float-time last-valid)
+ (float-time (cdr clock))) 45))
(start-over (and subtractp barely-started-p)))
(cond
((memq ch '(?j ?J))
@@ -1047,8 +1047,8 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
(lambda (clock)
(format
"Dangling clock started %d mins ago"
- (floor (- (org-float-time)
- (org-float-time (cdr clock)))
+ (floor (- (float-time)
+ (float-time (cdr clock)))
60)))))
(or last-valid
(cdr clock)))))))))))
@@ -1057,7 +1057,7 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling
"Return the current Emacs idle time in seconds, or nil if not idle."
(let ((idle-time (current-idle-time)))
(if idle-time
- (org-float-time idle-time)
+ (float-time idle-time)
0)))
(defun org-mac-idle-seconds ()
@@ -1109,7 +1109,7 @@ so long."
(function
(lambda (clock)
(format "Clocked in & idle for %.1f mins"
- (/ (org-float-time
+ (/ (float-time
(time-subtract (current-time)
org-clock-user-idle-start))
60.0))))
@@ -1271,9 +1271,9 @@ make this the default behavior.)"
(y-or-n-p
(format
"You stopped another clock %d mins ago; start this one from then? "
- (/ (- (org-float-time
+ (/ (- (float-time
(org-current-time org-clock-rounding-minutes t))
- (org-float-time leftover)) 60)))
+ (float-time leftover)) 60)))
leftover)
start-time
(org-current-time org-clock-rounding-minutes t)))
@@ -1517,8 +1517,8 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
(delete-region (point) (point-at-eol))
(insert "--")
(setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
- (setq s (- (org-float-time (apply 'encode-time (org-parse-time-string te)))
- (org-float-time (apply 'encode-time (org-parse-time-string ts))))
+ (setq s (- (float-time (apply 'encode-time (org-parse-time-string te)))
+ (float-time (apply 'encode-time (org-parse-time-string ts))))
h (floor (/ s 3600))
s (- s (* 3600 h))
m (floor (/ s 60))
@@ -1630,13 +1630,13 @@ Optional argument N tells to change by that many units."
(let ((ts (if updatets1 ts2 ts1))
(begts (if updatets1 begts1 begts2)))
(setq tdiff
- (subtract-time
+ (time-subtract
(org-time-string-to-time org-last-changed-timestamp)
(org-time-string-to-time ts)))
(save-excursion
(goto-char begts)
(org-timestamp-change
- (round (/ (org-float-time tdiff)
+ (round (/ (float-time tdiff)
(cond ((eq org-ts-what 'minute) 60)
((eq org-ts-what 'hour) 3600)
((eq org-ts-what 'day) (* 24 3600))
@@ -1739,8 +1739,8 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
time)
(if (stringp tstart) (setq tstart (org-time-string-to-seconds tstart)))
(if (stringp tend) (setq tend (org-time-string-to-seconds tend)))
- (if (consp tstart) (setq tstart (org-float-time tstart)))
- (if (consp tend) (setq tend (org-float-time tend)))
+ (if (consp tstart) (setq tstart (float-time tstart)))
+ (if (consp tend) (setq tend (float-time tend)))
(remove-text-properties (point-min) (point-max)
`(,(or propname :org-clock-minutes) t
:org-clock-force-headline-inclusion t))
@@ -1752,9 +1752,9 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
;; Two time stamps
(setq ts (match-string 2)
te (match-string 3)
- ts (org-float-time
+ ts (float-time
(apply 'encode-time (org-parse-time-string ts)))
- te (org-float-time
+ te (float-time
(apply 'encode-time (org-parse-time-string te)))
ts (if tstart (max ts tstart) ts)
te (if tend (min te tend) te)
@@ -1771,10 +1771,10 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(equal (marker-position org-clock-hd-marker) (point))
tstart
tend
- (>= (org-float-time org-clock-start-time) tstart)
- (<= (org-float-time org-clock-start-time) tend))
- (let ((time (floor (- (org-float-time)
- (org-float-time org-clock-start-time)) 60)))
+ (>= (float-time org-clock-start-time) tstart)
+ (<= (float-time org-clock-start-time) tend))
+ (let ((time (floor (- (float-time)
+ (float-time org-clock-start-time)) 60)))
(setq t1 (+ t1 time))))
(let* ((headline-forced
(get-text-property (point)
@@ -2584,17 +2584,17 @@ from the dynamic block definition."
((numberp ts)
;; If ts is a number, it's an absolute day number from org-agenda.
(destructuring-bind (month day year) (calendar-gregorian-from-absolute ts)
- (setq ts (org-float-time (encode-time 0 0 0 day month year)))))
+ (setq ts (float-time (encode-time 0 0 0 day month year)))))
(ts
- (setq ts (org-float-time
+ (setq ts (float-time
(apply 'encode-time (org-parse-time-string ts))))))
(cond
((numberp te)
;; Likewise for te.
(destructuring-bind (month day year) (calendar-gregorian-from-absolute te)
- (setq te (org-float-time (encode-time 0 0 0 day month year)))))
+ (setq te (float-time (encode-time 0 0 0 day month year)))))
(te
- (setq te (org-float-time
+ (setq te (float-time
(apply 'encode-time (org-parse-time-string te))))))
(setq tsb
(if (eq step0 'week)
@@ -2788,9 +2788,9 @@ Otherwise, return nil."
(end-of-line 1)
(setq ts (match-string 1)
te (match-string 3))
- (setq s (- (org-float-time
+ (setq s (- (float-time
(apply 'encode-time (org-parse-time-string te)))
- (org-float-time
+ (float-time
(apply 'encode-time (org-parse-time-string ts))))
neg (< s 0)
s (abs s)