diff options
| author | Paul Eggert | 2016-05-08 12:46:00 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-05-08 12:46:22 -0700 |
| commit | e2f785991d0c696fbb2bc2f331f888d979b8da82 (patch) | |
| tree | ba345e8547f4542bfe9bbb9ef311405bd519cd97 /lisp/org | |
| parent | 2eb6817ba971184cc109f8530f4b3b38f65650ea (diff) | |
| download | emacs-e2f785991d0c696fbb2bc2f331f888d979b8da82.tar.gz emacs-e2f785991d0c696fbb2bc2f331f888d979b8da82.zip | |
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')
| -rw-r--r-- | lisp/org/org-agenda.el | 12 | ||||
| -rw-r--r-- | lisp/org/org-clock.el | 58 | ||||
| -rw-r--r-- | lisp/org/org-compat.el | 3 | ||||
| -rw-r--r-- | lisp/org/org-list.el | 2 | ||||
| -rw-r--r-- | lisp/org/org-timer.el | 16 | ||||
| -rw-r--r-- | lisp/org/org.el | 23 |
6 files changed, 56 insertions, 58 deletions
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index e77b53aadca..fd5253ab1b7 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el | |||
| @@ -3903,7 +3903,7 @@ functions do." | |||
| 3903 | 3903 | ||
| 3904 | (defvar org-agenda-markers nil | 3904 | (defvar org-agenda-markers nil |
| 3905 | "List of all currently active markers created by `org-agenda'.") | 3905 | "List of all currently active markers created by `org-agenda'.") |
| 3906 | (defvar org-agenda-last-marker-time (org-float-time) | 3906 | (defvar org-agenda-last-marker-time (float-time) |
| 3907 | "Creation time of the last agenda marker.") | 3907 | "Creation time of the last agenda marker.") |
| 3908 | 3908 | ||
| 3909 | (defun org-agenda-new-marker (&optional pos) | 3909 | (defun org-agenda-new-marker (&optional pos) |
| @@ -3911,7 +3911,7 @@ functions do." | |||
| 3911 | Org-mode keeps a list of these markers and resets them when they are | 3911 | Org-mode keeps a list of these markers and resets them when they are |
| 3912 | no longer in use." | 3912 | no longer in use." |
| 3913 | (let ((m (copy-marker (or pos (point))))) | 3913 | (let ((m (copy-marker (or pos (point))))) |
| 3914 | (setq org-agenda-last-marker-time (org-float-time)) | 3914 | (setq org-agenda-last-marker-time (float-time)) |
| 3915 | (if org-agenda-buffer | 3915 | (if org-agenda-buffer |
| 3916 | (with-current-buffer org-agenda-buffer | 3916 | (with-current-buffer org-agenda-buffer |
| 3917 | (push m org-agenda-markers)) | 3917 | (push m org-agenda-markers)) |
| @@ -5231,7 +5231,7 @@ So the example above may also be written as | |||
| 5231 | The function expects the lisp variables `entry' and `date' to be provided | 5231 | The function expects the lisp variables `entry' and `date' to be provided |
| 5232 | by the caller, because this is how the calendar works. Don't use this | 5232 | by the caller, because this is how the calendar works. Don't use this |
| 5233 | function from a program - use `org-agenda-get-day-entries' instead." | 5233 | function from a program - use `org-agenda-get-day-entries' instead." |
| 5234 | (when (> (- (org-float-time) | 5234 | (when (> (- (float-time) |
| 5235 | org-agenda-last-marker-time) | 5235 | org-agenda-last-marker-time) |
| 5236 | 5) | 5236 | 5) |
| 5237 | ;; I am not sure if this works with sticky agendas, because the marker | 5237 | ;; I am not sure if this works with sticky agendas, because the marker |
| @@ -5243,7 +5243,7 @@ function from a program - use `org-agenda-get-day-entries' instead." | |||
| 5243 | (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) | 5243 | (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) |
| 5244 | (list entry) | 5244 | (list entry) |
| 5245 | (org-agenda-files t))) | 5245 | (org-agenda-files t))) |
| 5246 | (time (org-float-time)) | 5246 | (time (float-time)) |
| 5247 | file rtn results) | 5247 | file rtn results) |
| 5248 | (when (or (not org-diary-last-run-time) | 5248 | (when (or (not org-diary-last-run-time) |
| 5249 | (> (- time | 5249 | (> (- time |
| @@ -5912,9 +5912,9 @@ See also the user option `org-agenda-clock-consistency-checks'." | |||
| 5912 | (throw 'next t)) | 5912 | (throw 'next t)) |
| 5913 | (setq ts (match-string 1) | 5913 | (setq ts (match-string 1) |
| 5914 | te (match-string 3) | 5914 | te (match-string 3) |
| 5915 | ts (org-float-time | 5915 | ts (float-time |
| 5916 | (apply 'encode-time (org-parse-time-string ts))) | 5916 | (apply 'encode-time (org-parse-time-string ts))) |
| 5917 | te (org-float-time | 5917 | te (float-time |
| 5918 | (apply 'encode-time (org-parse-time-string te))) | 5918 | (apply 'encode-time (org-parse-time-string te))) |
| 5919 | dt (- te ts)))) | 5919 | dt (- te ts)))) |
| 5920 | (cond | 5920 | (cond |
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." | |||
| 658 | The time returned includes the time spent on this task in | 658 | The time returned includes the time spent on this task in |
| 659 | previous clocking intervals." | 659 | previous clocking intervals." |
| 660 | (let ((currently-clocked-time | 660 | (let ((currently-clocked-time |
| 661 | (floor (- (org-float-time) | 661 | (floor (- (float-time) |
| 662 | (org-float-time org-clock-start-time)) 60))) | 662 | (float-time org-clock-start-time)) 60))) |
| 663 | (+ currently-clocked-time (or org-clock-total-time 0)))) | 663 | (+ currently-clocked-time (or org-clock-total-time 0)))) |
| 664 | 664 | ||
| 665 | (defun org-clock-modify-effort-estimate (&optional value) | 665 | (defun org-clock-modify-effort-estimate (&optional value) |
| @@ -978,7 +978,7 @@ to be CLOCKED OUT.")))) | |||
| 978 | nil 45))) | 978 | nil 45))) |
| 979 | (and (not (memq char-pressed '(?i ?q))) char-pressed))))) | 979 | (and (not (memq char-pressed '(?i ?q))) char-pressed))))) |
| 980 | (default | 980 | (default |
| 981 | (floor (/ (org-float-time | 981 | (floor (/ (float-time |
| 982 | (time-subtract (current-time) last-valid)) 60))) | 982 | (time-subtract (current-time) last-valid)) 60))) |
| 983 | (keep | 983 | (keep |
| 984 | (and (memq ch '(?k ?K)) | 984 | (and (memq ch '(?k ?K)) |
| @@ -987,8 +987,8 @@ to be CLOCKED OUT.")))) | |||
| 987 | (and (memq ch '(?g ?G)) | 987 | (and (memq ch '(?g ?G)) |
| 988 | (read-number "Got back how many minutes ago? " default))) | 988 | (read-number "Got back how many minutes ago? " default))) |
| 989 | (subtractp (memq ch '(?s ?S))) | 989 | (subtractp (memq ch '(?s ?S))) |
| 990 | (barely-started-p (< (- (org-float-time last-valid) | 990 | (barely-started-p (< (- (float-time last-valid) |
| 991 | (org-float-time (cdr clock))) 45)) | 991 | (float-time (cdr clock))) 45)) |
| 992 | (start-over (and subtractp barely-started-p))) | 992 | (start-over (and subtractp barely-started-p))) |
| 993 | (cond | 993 | (cond |
| 994 | ((memq ch '(?j ?J)) | 994 | ((memq ch '(?j ?J)) |
| @@ -1047,8 +1047,8 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling | |||
| 1047 | (lambda (clock) | 1047 | (lambda (clock) |
| 1048 | (format | 1048 | (format |
| 1049 | "Dangling clock started %d mins ago" | 1049 | "Dangling clock started %d mins ago" |
| 1050 | (floor (- (org-float-time) | 1050 | (floor (- (float-time) |
| 1051 | (org-float-time (cdr clock))) | 1051 | (float-time (cdr clock))) |
| 1052 | 60))))) | 1052 | 60))))) |
| 1053 | (or last-valid | 1053 | (or last-valid |
| 1054 | (cdr clock))))))))))) | 1054 | (cdr clock))))))))))) |
| @@ -1057,7 +1057,7 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling | |||
| 1057 | "Return the current Emacs idle time in seconds, or nil if not idle." | 1057 | "Return the current Emacs idle time in seconds, or nil if not idle." |
| 1058 | (let ((idle-time (current-idle-time))) | 1058 | (let ((idle-time (current-idle-time))) |
| 1059 | (if idle-time | 1059 | (if idle-time |
| 1060 | (org-float-time idle-time) | 1060 | (float-time idle-time) |
| 1061 | 0))) | 1061 | 0))) |
| 1062 | 1062 | ||
| 1063 | (defun org-mac-idle-seconds () | 1063 | (defun org-mac-idle-seconds () |
| @@ -1109,7 +1109,7 @@ so long." | |||
| 1109 | (function | 1109 | (function |
| 1110 | (lambda (clock) | 1110 | (lambda (clock) |
| 1111 | (format "Clocked in & idle for %.1f mins" | 1111 | (format "Clocked in & idle for %.1f mins" |
| 1112 | (/ (org-float-time | 1112 | (/ (float-time |
| 1113 | (time-subtract (current-time) | 1113 | (time-subtract (current-time) |
| 1114 | org-clock-user-idle-start)) | 1114 | org-clock-user-idle-start)) |
| 1115 | 60.0)))) | 1115 | 60.0)))) |
| @@ -1271,9 +1271,9 @@ make this the default behavior.)" | |||
| 1271 | (y-or-n-p | 1271 | (y-or-n-p |
| 1272 | (format | 1272 | (format |
| 1273 | "You stopped another clock %d mins ago; start this one from then? " | 1273 | "You stopped another clock %d mins ago; start this one from then? " |
| 1274 | (/ (- (org-float-time | 1274 | (/ (- (float-time |
| 1275 | (org-current-time org-clock-rounding-minutes t)) | 1275 | (org-current-time org-clock-rounding-minutes t)) |
| 1276 | (org-float-time leftover)) 60))) | 1276 | (float-time leftover)) 60))) |
| 1277 | leftover) | 1277 | leftover) |
| 1278 | start-time | 1278 | start-time |
| 1279 | (org-current-time org-clock-rounding-minutes t))) | 1279 | (org-current-time org-clock-rounding-minutes t))) |
| @@ -1517,8 +1517,8 @@ to, overriding the existing value of `org-clock-out-switch-to-state'." | |||
| 1517 | (delete-region (point) (point-at-eol)) | 1517 | (delete-region (point) (point-at-eol)) |
| 1518 | (insert "--") | 1518 | (insert "--") |
| 1519 | (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive)) | 1519 | (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive)) |
| 1520 | (setq s (- (org-float-time (apply 'encode-time (org-parse-time-string te))) | 1520 | (setq s (- (float-time (apply 'encode-time (org-parse-time-string te))) |
| 1521 | (org-float-time (apply 'encode-time (org-parse-time-string ts)))) | 1521 | (float-time (apply 'encode-time (org-parse-time-string ts)))) |
| 1522 | h (floor (/ s 3600)) | 1522 | h (floor (/ s 3600)) |
| 1523 | s (- s (* 3600 h)) | 1523 | s (- s (* 3600 h)) |
| 1524 | m (floor (/ s 60)) | 1524 | m (floor (/ s 60)) |
| @@ -1630,13 +1630,13 @@ Optional argument N tells to change by that many units." | |||
| 1630 | (let ((ts (if updatets1 ts2 ts1)) | 1630 | (let ((ts (if updatets1 ts2 ts1)) |
| 1631 | (begts (if updatets1 begts1 begts2))) | 1631 | (begts (if updatets1 begts1 begts2))) |
| 1632 | (setq tdiff | 1632 | (setq tdiff |
| 1633 | (subtract-time | 1633 | (time-subtract |
| 1634 | (org-time-string-to-time org-last-changed-timestamp) | 1634 | (org-time-string-to-time org-last-changed-timestamp) |
| 1635 | (org-time-string-to-time ts))) | 1635 | (org-time-string-to-time ts))) |
| 1636 | (save-excursion | 1636 | (save-excursion |
| 1637 | (goto-char begts) | 1637 | (goto-char begts) |
| 1638 | (org-timestamp-change | 1638 | (org-timestamp-change |
| 1639 | (round (/ (org-float-time tdiff) | 1639 | (round (/ (float-time tdiff) |
| 1640 | (cond ((eq org-ts-what 'minute) 60) | 1640 | (cond ((eq org-ts-what 'minute) 60) |
| 1641 | ((eq org-ts-what 'hour) 3600) | 1641 | ((eq org-ts-what 'hour) 3600) |
| 1642 | ((eq org-ts-what 'day) (* 24 3600)) | 1642 | ((eq org-ts-what 'day) (* 24 3600)) |
| @@ -1739,8 +1739,8 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes." | |||
| 1739 | time) | 1739 | time) |
| 1740 | (if (stringp tstart) (setq tstart (org-time-string-to-seconds tstart))) | 1740 | (if (stringp tstart) (setq tstart (org-time-string-to-seconds tstart))) |
| 1741 | (if (stringp tend) (setq tend (org-time-string-to-seconds tend))) | 1741 | (if (stringp tend) (setq tend (org-time-string-to-seconds tend))) |
| 1742 | (if (consp tstart) (setq tstart (org-float-time tstart))) | 1742 | (if (consp tstart) (setq tstart (float-time tstart))) |
| 1743 | (if (consp tend) (setq tend (org-float-time tend))) | 1743 | (if (consp tend) (setq tend (float-time tend))) |
| 1744 | (remove-text-properties (point-min) (point-max) | 1744 | (remove-text-properties (point-min) (point-max) |
| 1745 | `(,(or propname :org-clock-minutes) t | 1745 | `(,(or propname :org-clock-minutes) t |
| 1746 | :org-clock-force-headline-inclusion t)) | 1746 | :org-clock-force-headline-inclusion t)) |
| @@ -1752,9 +1752,9 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes." | |||
| 1752 | ;; Two time stamps | 1752 | ;; Two time stamps |
| 1753 | (setq ts (match-string 2) | 1753 | (setq ts (match-string 2) |
| 1754 | te (match-string 3) | 1754 | te (match-string 3) |
| 1755 | ts (org-float-time | 1755 | ts (float-time |
| 1756 | (apply 'encode-time (org-parse-time-string ts))) | 1756 | (apply 'encode-time (org-parse-time-string ts))) |
| 1757 | te (org-float-time | 1757 | te (float-time |
| 1758 | (apply 'encode-time (org-parse-time-string te))) | 1758 | (apply 'encode-time (org-parse-time-string te))) |
| 1759 | ts (if tstart (max ts tstart) ts) | 1759 | ts (if tstart (max ts tstart) ts) |
| 1760 | te (if tend (min te tend) te) | 1760 | te (if tend (min te tend) te) |
| @@ -1771,10 +1771,10 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes." | |||
| 1771 | (equal (marker-position org-clock-hd-marker) (point)) | 1771 | (equal (marker-position org-clock-hd-marker) (point)) |
| 1772 | tstart | 1772 | tstart |
| 1773 | tend | 1773 | tend |
| 1774 | (>= (org-float-time org-clock-start-time) tstart) | 1774 | (>= (float-time org-clock-start-time) tstart) |
| 1775 | (<= (org-float-time org-clock-start-time) tend)) | 1775 | (<= (float-time org-clock-start-time) tend)) |
| 1776 | (let ((time (floor (- (org-float-time) | 1776 | (let ((time (floor (- (float-time) |
| 1777 | (org-float-time org-clock-start-time)) 60))) | 1777 | (float-time org-clock-start-time)) 60))) |
| 1778 | (setq t1 (+ t1 time)))) | 1778 | (setq t1 (+ t1 time)))) |
| 1779 | (let* ((headline-forced | 1779 | (let* ((headline-forced |
| 1780 | (get-text-property (point) | 1780 | (get-text-property (point) |
| @@ -2584,17 +2584,17 @@ from the dynamic block definition." | |||
| 2584 | ((numberp ts) | 2584 | ((numberp ts) |
| 2585 | ;; If ts is a number, it's an absolute day number from org-agenda. | 2585 | ;; If ts is a number, it's an absolute day number from org-agenda. |
| 2586 | (destructuring-bind (month day year) (calendar-gregorian-from-absolute ts) | 2586 | (destructuring-bind (month day year) (calendar-gregorian-from-absolute ts) |
| 2587 | (setq ts (org-float-time (encode-time 0 0 0 day month year))))) | 2587 | (setq ts (float-time (encode-time 0 0 0 day month year))))) |
| 2588 | (ts | 2588 | (ts |
| 2589 | (setq ts (org-float-time | 2589 | (setq ts (float-time |
| 2590 | (apply 'encode-time (org-parse-time-string ts)))))) | 2590 | (apply 'encode-time (org-parse-time-string ts)))))) |
| 2591 | (cond | 2591 | (cond |
| 2592 | ((numberp te) | 2592 | ((numberp te) |
| 2593 | ;; Likewise for te. | 2593 | ;; Likewise for te. |
| 2594 | (destructuring-bind (month day year) (calendar-gregorian-from-absolute te) | 2594 | (destructuring-bind (month day year) (calendar-gregorian-from-absolute te) |
| 2595 | (setq te (org-float-time (encode-time 0 0 0 day month year))))) | 2595 | (setq te (float-time (encode-time 0 0 0 day month year))))) |
| 2596 | (te | 2596 | (te |
| 2597 | (setq te (org-float-time | 2597 | (setq te (float-time |
| 2598 | (apply 'encode-time (org-parse-time-string te)))))) | 2598 | (apply 'encode-time (org-parse-time-string te)))))) |
| 2599 | (setq tsb | 2599 | (setq tsb |
| 2600 | (if (eq step0 'week) | 2600 | (if (eq step0 'week) |
| @@ -2788,9 +2788,9 @@ Otherwise, return nil." | |||
| 2788 | (end-of-line 1) | 2788 | (end-of-line 1) |
| 2789 | (setq ts (match-string 1) | 2789 | (setq ts (match-string 1) |
| 2790 | te (match-string 3)) | 2790 | te (match-string 3)) |
| 2791 | (setq s (- (org-float-time | 2791 | (setq s (- (float-time |
| 2792 | (apply 'encode-time (org-parse-time-string te))) | 2792 | (apply 'encode-time (org-parse-time-string te))) |
| 2793 | (org-float-time | 2793 | (float-time |
| 2794 | (apply 'encode-time (org-parse-time-string ts)))) | 2794 | (apply 'encode-time (org-parse-time-string ts)))) |
| 2795 | neg (< s 0) | 2795 | neg (< s 0) |
| 2796 | s (abs s) | 2796 | s (abs s) |
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index cf6aafc9854..9a79a4bc2b1 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el | |||
| @@ -411,8 +411,7 @@ Pass BUFFER to the XEmacs version of `move-to-column'." | |||
| 411 | (when focus-follows-mouse | 411 | (when focus-follows-mouse |
| 412 | (set-mouse-position frame (1- (frame-width frame)) 0))))) | 412 | (set-mouse-position frame (1- (frame-width frame)) 0))))) |
| 413 | 413 | ||
| 414 | (defalias 'org-float-time | 414 | (define-obsolete-function-alias 'org-float-time 'float-time "26.1") |
| 415 | (if (featurep 'xemacs) 'time-to-seconds 'float-time)) | ||
| 416 | 415 | ||
| 417 | ;; `user-error' is only available from 24.2.50 on | 416 | ;; `user-error' is only available from 24.2.50 on |
| 418 | (unless (fboundp 'user-error) | 417 | (unless (fboundp 'user-error) |
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index 2c1e3775b0d..e119fbf3542 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el | |||
| @@ -2884,7 +2884,7 @@ ignores hidden links." | |||
| 2884 | (save-excursion (re-search-forward org-ts-regexp-both | 2884 | (save-excursion (re-search-forward org-ts-regexp-both |
| 2885 | (point-at-eol) t))) | 2885 | (point-at-eol) t))) |
| 2886 | (org-time-string-to-seconds (match-string 0))) | 2886 | (org-time-string-to-seconds (match-string 0))) |
| 2887 | (t (org-float-time now)))) | 2887 | (t (float-time now)))) |
| 2888 | ((= dcst ?x) (or (and (stringp (match-string 1)) | 2888 | ((= dcst ?x) (or (and (stringp (match-string 1)) |
| 2889 | (match-string 1)) | 2889 | (match-string 1)) |
| 2890 | "")) | 2890 | "")) |
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index 667f6021b0d..079bed42d0d 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el | |||
| @@ -123,7 +123,7 @@ the region 0:00:00." | |||
| 123 | (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s))))) | 123 | (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s))))) |
| 124 | (setq org-timer-start-time | 124 | (setq org-timer-start-time |
| 125 | (seconds-to-time | 125 | (seconds-to-time |
| 126 | (- (org-float-time) delta)))) | 126 | (- (float-time) delta)))) |
| 127 | (org-timer-set-mode-line 'on) | 127 | (org-timer-set-mode-line 'on) |
| 128 | (message "Timer start time set to %s, current value is %s" | 128 | (message "Timer start time set to %s, current value is %s" |
| 129 | (format-time-string "%T" org-timer-start-time) | 129 | (format-time-string "%T" org-timer-start-time) |
| @@ -142,9 +142,9 @@ With prefix arg STOP, stop it entirely." | |||
| 142 | (setq org-timer-start-time | 142 | (setq org-timer-start-time |
| 143 | (seconds-to-time | 143 | (seconds-to-time |
| 144 | (- | 144 | (- |
| 145 | (org-float-time) | 145 | (float-time) |
| 146 | (- (org-float-time org-timer-pause-time) | 146 | (- (float-time org-timer-pause-time) |
| 147 | (org-float-time org-timer-start-time)))) | 147 | (float-time org-timer-start-time)))) |
| 148 | org-timer-pause-time nil) | 148 | org-timer-pause-time nil) |
| 149 | (org-timer-set-mode-line 'on) | 149 | (org-timer-set-mode-line 'on) |
| 150 | (run-hooks 'org-timer-continue-hook) | 150 | (run-hooks 'org-timer-continue-hook) |
| @@ -194,10 +194,10 @@ it in the buffer." | |||
| 194 | (defvar org-timer-timer-is-countdown nil) | 194 | (defvar org-timer-timer-is-countdown nil) |
| 195 | (defun org-timer-seconds () | 195 | (defun org-timer-seconds () |
| 196 | (if org-timer-timer-is-countdown | 196 | (if org-timer-timer-is-countdown |
| 197 | (- (org-float-time org-timer-start-time) | 197 | (- (float-time org-timer-start-time) |
| 198 | (org-float-time)) | 198 | (float-time)) |
| 199 | (- (org-float-time org-timer-pause-time) | 199 | (- (float-time org-timer-pause-time) |
| 200 | (org-float-time org-timer-start-time)))) | 200 | (float-time org-timer-start-time)))) |
| 201 | 201 | ||
| 202 | ;;;###autoload | 202 | ;;;###autoload |
| 203 | (defun org-timer-change-times-in-region (beg end delta) | 203 | (defun org-timer-change-times-in-region (beg end delta) |
diff --git a/lisp/org/org.el b/lisp/org/org.el index 1921a59bbd0..e2fbf7bc314 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el | |||
| @@ -5280,7 +5280,6 @@ This variable is set by `org-before-change-function'. | |||
| 5280 | 5280 | ||
| 5281 | ;; Other stuff we need. | 5281 | ;; Other stuff we need. |
| 5282 | (require 'time-date) | 5282 | (require 'time-date) |
| 5283 | (unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time)) | ||
| 5284 | (require 'easymenu) | 5283 | (require 'easymenu) |
| 5285 | (require 'overlay) | 5284 | (require 'overlay) |
| 5286 | 5285 | ||
| @@ -5514,8 +5513,8 @@ the rounding returns a past time." | |||
| 5514 | (apply 'encode-time | 5513 | (apply 'encode-time |
| 5515 | (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r))))) | 5514 | (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r))))) |
| 5516 | (nthcdr 2 time)))) | 5515 | (nthcdr 2 time)))) |
| 5517 | (if (and past (< (org-float-time (time-subtract (current-time) res)) 0)) | 5516 | (if (and past (< (float-time (time-subtract (current-time) res)) 0)) |
| 5518 | (seconds-to-time (- (org-float-time res) (* r 60))) | 5517 | (seconds-to-time (- (float-time res) (* r 60))) |
| 5519 | res)))) | 5518 | res)))) |
| 5520 | 5519 | ||
| 5521 | (defun org-today () | 5520 | (defun org-today () |
| @@ -8779,24 +8778,24 @@ links." | |||
| 8779 | (if (or (re-search-forward org-ts-regexp end t) | 8778 | (if (or (re-search-forward org-ts-regexp end t) |
| 8780 | (re-search-forward org-ts-regexp-both end t)) | 8779 | (re-search-forward org-ts-regexp-both end t)) |
| 8781 | (org-time-string-to-seconds (match-string 0)) | 8780 | (org-time-string-to-seconds (match-string 0)) |
| 8782 | (org-float-time now)))) | 8781 | (float-time now)))) |
| 8783 | ((= dcst ?c) | 8782 | ((= dcst ?c) |
| 8784 | (let ((end (save-excursion (outline-next-heading) (point)))) | 8783 | (let ((end (save-excursion (outline-next-heading) (point)))) |
| 8785 | (if (re-search-forward | 8784 | (if (re-search-forward |
| 8786 | (concat "^[ \t]*\\[" org-ts-regexp1 "\\]") | 8785 | (concat "^[ \t]*\\[" org-ts-regexp1 "\\]") |
| 8787 | end t) | 8786 | end t) |
| 8788 | (org-time-string-to-seconds (match-string 0)) | 8787 | (org-time-string-to-seconds (match-string 0)) |
| 8789 | (org-float-time now)))) | 8788 | (float-time now)))) |
| 8790 | ((= dcst ?s) | 8789 | ((= dcst ?s) |
| 8791 | (let ((end (save-excursion (outline-next-heading) (point)))) | 8790 | (let ((end (save-excursion (outline-next-heading) (point)))) |
| 8792 | (if (re-search-forward org-scheduled-time-regexp end t) | 8791 | (if (re-search-forward org-scheduled-time-regexp end t) |
| 8793 | (org-time-string-to-seconds (match-string 1)) | 8792 | (org-time-string-to-seconds (match-string 1)) |
| 8794 | (org-float-time now)))) | 8793 | (float-time now)))) |
| 8795 | ((= dcst ?d) | 8794 | ((= dcst ?d) |
| 8796 | (let ((end (save-excursion (outline-next-heading) (point)))) | 8795 | (let ((end (save-excursion (outline-next-heading) (point)))) |
| 8797 | (if (re-search-forward org-deadline-time-regexp end t) | 8796 | (if (re-search-forward org-deadline-time-regexp end t) |
| 8798 | (org-time-string-to-seconds (match-string 1)) | 8797 | (org-time-string-to-seconds (match-string 1)) |
| 8799 | (org-float-time now)))) | 8798 | (float-time now)))) |
| 8800 | ((= dcst ?p) | 8799 | ((= dcst ?p) |
| 8801 | (if (re-search-forward org-priority-regexp (point-at-eol) t) | 8800 | (if (re-search-forward org-priority-regexp (point-at-eol) t) |
| 8802 | (string-to-char (match-string 2)) | 8801 | (string-to-char (match-string 2)) |
| @@ -8860,7 +8859,7 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive." | |||
| 8860 | (lambda (x) | 8859 | (lambda (x) |
| 8861 | (if (or (string-match org-ts-regexp x) | 8860 | (if (or (string-match org-ts-regexp x) |
| 8862 | (string-match org-ts-regexp-both x)) | 8861 | (string-match org-ts-regexp-both x)) |
| 8863 | (org-float-time | 8862 | (float-time |
| 8864 | (org-time-string-to-time (match-string 0 x))) | 8863 | (org-time-string-to-time (match-string 0 x))) |
| 8865 | 0)) | 8864 | 0)) |
| 8866 | comparefun (if (= dcst sorting-type) '< '>))) | 8865 | comparefun (if (= dcst sorting-type) '< '>))) |
| @@ -16886,7 +16885,7 @@ Don't touch the rest." | |||
| 16886 | (defun org-time-stamp-to-now (timestamp-string &optional seconds) | 16885 | (defun org-time-stamp-to-now (timestamp-string &optional seconds) |
| 16887 | "Difference between TIMESTAMP-STRING and now in days. | 16886 | "Difference between TIMESTAMP-STRING and now in days. |
| 16888 | If SECONDS is non-nil, return the difference in seconds." | 16887 | If SECONDS is non-nil, return the difference in seconds." |
| 16889 | (let ((fdiff (if seconds 'org-float-time 'time-to-days))) | 16888 | (let ((fdiff (if seconds 'float-time 'time-to-days))) |
| 16890 | (- (funcall fdiff (org-time-string-to-time timestamp-string)) | 16889 | (- (funcall fdiff (org-time-string-to-time timestamp-string)) |
| 16891 | (funcall fdiff (current-time))))) | 16890 | (funcall fdiff (current-time))))) |
| 16892 | 16891 | ||
| @@ -17041,8 +17040,8 @@ days in order to avoid rounding problems." | |||
| 17041 | (match-end (match-end 0)) | 17040 | (match-end (match-end 0)) |
| 17042 | (time1 (org-time-string-to-time ts1)) | 17041 | (time1 (org-time-string-to-time ts1)) |
| 17043 | (time2 (org-time-string-to-time ts2)) | 17042 | (time2 (org-time-string-to-time ts2)) |
| 17044 | (t1 (org-float-time time1)) | 17043 | (t1 (float-time time1)) |
| 17045 | (t2 (org-float-time time2)) | 17044 | (t2 (float-time time2)) |
| 17046 | (diff (abs (- t2 t1))) | 17045 | (diff (abs (- t2 t1))) |
| 17047 | (negative (< (- t2 t1) 0)) | 17046 | (negative (< (- t2 t1) 0)) |
| 17048 | ;; (ys (floor (* 365 24 60 60))) | 17047 | ;; (ys (floor (* 365 24 60 60))) |
| @@ -17107,7 +17106,7 @@ days in order to avoid rounding problems." | |||
| 17107 | 17106 | ||
| 17108 | (defun org-time-string-to-seconds (s) | 17107 | (defun org-time-string-to-seconds (s) |
| 17109 | "Convert a timestamp string to a number of seconds." | 17108 | "Convert a timestamp string to a number of seconds." |
| 17110 | (org-float-time (org-time-string-to-time s))) | 17109 | (float-time (org-time-string-to-time s))) |
| 17111 | 17110 | ||
| 17112 | (defun org-time-string-to-absolute (s &optional daynr prefer show-all buffer pos) | 17111 | (defun org-time-string-to-absolute (s &optional daynr prefer show-all buffer pos) |
| 17113 | "Convert a time stamp to an absolute day number. | 17112 | "Convert a time stamp to an absolute day number. |