summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/calendar/time-date.el104
-rw-r--r--lisp/calendar/timeclock.el60
-rw-r--r--lisp/emacs-lisp/ert.el2
-rw-r--r--lisp/erc/erc.el6
-rw-r--r--lisp/files.el8
-rw-r--r--lisp/gnus/gnus-art.el2
-rw-r--r--lisp/gnus/gnus-diary.el2
-rw-r--r--lisp/gnus/gnus-group.el2
-rw-r--r--lisp/gnus/nndiary.el12
-rw-r--r--lisp/net/newst-backend.el7
-rw-r--r--lisp/net/rcirc.el11
-rw-r--r--lisp/net/tramp.el2
-rw-r--r--lisp/org/org-agenda.el12
-rw-r--r--lisp/org/org-clock.el58
-rw-r--r--lisp/org/org-compat.el3
-rw-r--r--lisp/org/org-list.el2
-rw-r--r--lisp/org/org-timer.el16
-rw-r--r--lisp/org/org.el23
18 files changed, 116 insertions, 216 deletions
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index da3e2a267db..a1d946eac74 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -126,16 +126,17 @@ type 2 is (HIGH LOW MICRO), and type 3 is (HIGH LOW MICRO PICO).
For backward compatibility, if only four arguments are given,
it is assumed that PICO was omitted and should be treated as zero."
+ (when (null type)
+ (setq type pico)
+ (setq pico 0))
(cond
((eq type 0) (cons high low))
((eq type 1) (list high low))
((eq type 2) (list high low micro))
- ((eq type 3) (list high low micro pico))
- ((null type) (encode-time-value high low micro 0 pico))))
+ ((eq type 3) (list high low micro pico))))
-(when (and (fboundp 'time-add) (subrp (symbol-function 'time-add)))
- (make-obsolete 'encode-time-value nil "25.1")
- (make-obsolete 'with-decoded-time-value nil "25.1"))
+(make-obsolete 'encode-time-value nil "25.1")
+(make-obsolete 'with-decoded-time-value nil "25.1")
(autoload 'parse-time-string "parse-time")
(autoload 'timezone-make-date-arpa-standard "timezone")
@@ -163,27 +164,8 @@ If DATE lacks timezone information, GMT is assumed."
(apply 'signal err)
(error "Invalid date: %s" date)))))))))
-;; Bit of a mess. Emacs has float-time since at least 21.1.
-;; This file is synced to Gnus, and XEmacs packages may have been written
-;; using time-to-seconds from the Gnus library.
-;;;###autoload(if (or (featurep 'emacs)
-;;;###autoload (and (fboundp 'float-time)
-;;;###autoload (subrp (symbol-function 'float-time))))
-;;;###autoload (defalias 'time-to-seconds 'float-time)
-;;;###autoload (autoload 'time-to-seconds "time-date"))
-
-(eval-when-compile
- (or (featurep 'emacs)
- (and (fboundp 'float-time)
- (subrp (symbol-function 'float-time)))
- (defun time-to-seconds (&optional time)
- "Convert optional value TIME to a floating point number.
-TIME defaults to the current time."
- (with-decoded-time-value ((high low micro pico _type
- (or time (current-time))))
- (+ (* high 65536.0)
- low
- (/ (+ (* micro 1e6) pico) 1e12))))))
+;;;###autoload
+(defalias 'time-to-seconds 'float-time)
;;;###autoload
(defun seconds-to-time (seconds)
@@ -209,68 +191,7 @@ TIME should be either a time value or a date-time string."
(time-subtract nil time))
;;;###autoload
-(defalias 'subtract-time 'time-subtract)
-
-;; These autoloads do nothing in Emacs 25, where the functions are builtin.
-;;;###autoload(autoload 'time-add "time-date")
-;;;###autoload(autoload 'time-subtract "time-date")
-;;;###autoload(autoload 'time-less-p "time-date")
-
-(eval-and-compile
- (when (not (and (fboundp 'time-add) (subrp (symbol-function 'time-add))))
-
- (defun time-add (t1 t2)
- "Add two time values T1 and T2. One should represent a time difference."
- (with-decoded-time-value ((high low micro pico type t1)
- (high2 low2 micro2 pico2 type2 t2))
- (setq high (+ high high2)
- low (+ low low2)
- micro (+ micro micro2)
- pico (+ pico pico2)
- type (max type type2))
- (when (>= pico 1000000)
- (setq micro (1+ micro)
- pico (- pico 1000000)))
- (when (>= micro 1000000)
- (setq low (1+ low)
- micro (- micro 1000000)))
- (when (>= low 65536)
- (setq high (1+ high)
- low (- low 65536)))
- (encode-time-value high low micro pico type)))
-
- (defun time-subtract (t1 t2)
- "Subtract two time values, T1 minus T2.
-Return the difference in the format of a time value."
- (with-decoded-time-value ((high low micro pico type t1)
- (high2 low2 micro2 pico2 type2 t2))
- (setq high (- high high2)
- low (- low low2)
- micro (- micro micro2)
- pico (- pico pico2)
- type (max type type2))
- (when (< pico 0)
- (setq micro (1- micro)
- pico (+ pico 1000000)))
- (when (< micro 0)
- (setq low (1- low)
- micro (+ micro 1000000)))
- (when (< low 0)
- (setq high (1- high)
- low (+ low 65536)))
- (encode-time-value high low micro pico type)))
-
- (defun time-less-p (t1 t2)
- "Return non-nil if time value T1 is earlier than time value T2."
- (with-decoded-time-value ((high1 low1 micro1 pico1 _type1 t1)
- (high2 low2 micro2 pico2 _type2 t2))
- (or (< high1 high2)
- (and (= high1 high2)
- (or (< low1 low2)
- (and (= low1 low2)
- (or (< micro1 micro2)
- (and (= micro1 micro2)
- (< pico1 pico2)))))))))))
+(define-obsolete-function-alias 'subtract-time 'time-subtract "26.1")
;;;###autoload
(defun date-to-day (date)
@@ -324,12 +245,7 @@ The Gregorian date Sunday, December 31, 1bce is imaginary."
(defun time-to-number-of-days (time)
"Return the number of days represented by TIME.
Returns a floating point number."
- (/ (funcall (eval-when-compile
- (if (or (featurep 'emacs)
- (and (fboundp 'float-time)
- (subrp (symbol-function 'float-time))))
- 'float-time
- 'time-to-seconds)) time) (* 60 60 24)))
+ (/ (float-time time) (* 60 60 24)))
;;;###autoload
(defun safe-date-to-time (date)
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index 2bdfd98344a..3d9e2462224 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -532,18 +532,17 @@ non-nil, the amount returned will be relative to past time worked."
(message "%s" string)
string)))
-(defalias 'timeclock-time-to-seconds (if (fboundp 'float-time) 'float-time
- 'time-to-seconds))
-
-(defalias 'timeclock-seconds-to-time 'seconds-to-time)
+(define-obsolete-function-alias 'timeclock-time-to-seconds 'float-time "26.1")
+(define-obsolete-function-alias 'timeclock-seconds-to-time 'seconds-to-time
+ "26.1")
;; Should today-only be removed in favor of timeclock-relative? - gm
(defsubst timeclock-when-to-leave (&optional today-only)
"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."
- (timeclock-seconds-to-time
- (- (timeclock-time-to-seconds)
+ (seconds-to-time
+ (- (float-time)
(let ((discrep (timeclock-find-discrep)))
(if discrep
(if today-only
@@ -686,9 +685,8 @@ being logged for. Normally only \"in\" events specify a project."
"\n")
(if (equal (downcase code) "o")
(setq timeclock-last-period
- (- (timeclock-time-to-seconds now)
- (timeclock-time-to-seconds
- (cadr timeclock-last-event)))
+ (- (float-time now)
+ (float-time (cadr timeclock-last-event)))
timeclock-discrepancy
(+ timeclock-discrepancy
timeclock-last-period)))
@@ -723,14 +721,14 @@ recorded to disk. If MOMENT is non-nil, use that as the current time.
This is only provided for coherency when used by
`timeclock-discrepancy'."
(if (equal (car timeclock-last-event) "i")
- (- (timeclock-time-to-seconds moment)
- (timeclock-time-to-seconds (cadr timeclock-last-event)))
+ (- (float-time moment)
+ (float-time (cadr timeclock-last-event)))
timeclock-last-period))
(defsubst timeclock-entry-length (entry)
"Return the length of ENTRY in seconds."
- (- (timeclock-time-to-seconds (cadr entry))
- (timeclock-time-to-seconds (car entry))))
+ (- (float-time (cadr entry))
+ (float-time (car entry))))
(defsubst timeclock-entry-begin (entry)
"Return the start time of ENTRY."
@@ -765,8 +763,8 @@ This is only provided for coherency when used by
(defsubst timeclock-entry-list-span (entry-list)
"Return the total time in seconds spanned by ENTRY-LIST."
- (- (timeclock-time-to-seconds (timeclock-entry-list-end entry-list))
- (timeclock-time-to-seconds (timeclock-entry-list-begin entry-list))))
+ (- (float-time (timeclock-entry-list-end entry-list))
+ (float-time (timeclock-entry-list-begin entry-list))))
(defsubst timeclock-entry-list-break (entry-list)
"Return the total break time (span - length) in ENTRY-LIST."
@@ -1137,7 +1135,7 @@ discrepancy, today's discrepancy, and the time worked today."
last-date-limited nil)
(if beg
(error "Error in format of timelog file!")
- (setq beg (timeclock-time-to-seconds (cadr event))))))
+ (setq beg (float-time (cadr event))))))
((equal (downcase (car event)) "o")
(if (and (nth 2 event)
(> (length (nth 2 event)) 0))
@@ -1145,7 +1143,7 @@ discrepancy, today's discrepancy, and the time worked today."
(if (not beg)
(error "Error in format of timelog file!")
(setq timeclock-last-period
- (- (timeclock-time-to-seconds (cadr event)) beg)
+ (- (float-time (cadr event)) beg)
accum (+ timeclock-last-period accum)
beg nil))
(if (equal last-date todays-date)
@@ -1225,8 +1223,8 @@ 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 (timeclock-seconds-to-time
- (- (timeclock-time-to-seconds today)
+ (two-weeks-ago (seconds-to-time
+ (- (float-time today)
(* 2 7 24 60 60))))
two-week-len today-len)
(while proj-data
@@ -1278,17 +1276,17 @@ HTML-P is non-nil, HTML markup is added."
<th>-1 year</th>
</tr>")
(let* ((day-list (timeclock-day-list))
- (thirty-days-ago (timeclock-seconds-to-time
- (- (timeclock-time-to-seconds today)
+ (thirty-days-ago (seconds-to-time
+ (- (float-time today)
(* 30 24 60 60))))
- (three-months-ago (timeclock-seconds-to-time
- (- (timeclock-time-to-seconds today)
+ (three-months-ago (seconds-to-time
+ (- (float-time today)
(* 90 24 60 60))))
- (six-months-ago (timeclock-seconds-to-time
- (- (timeclock-time-to-seconds today)
+ (six-months-ago (seconds-to-time
+ (- (float-time today)
(* 180 24 60 60))))
- (one-year-ago (timeclock-seconds-to-time
- (- (timeclock-time-to-seconds today)
+ (one-year-ago (seconds-to-time
+ (- (float-time 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)))
@@ -1303,12 +1301,11 @@ HTML-P is non-nil, HTML markup is added."
(unless (time-less-p
(timeclock-day-begin day)
(aref lengths i))
- (let ((base (timeclock-time-to-seconds
+ (let ((base (float-time
(timeclock-day-base
(timeclock-day-begin day)))))
(nconc (aref time-in i)
- (list (- (timeclock-time-to-seconds
- (timeclock-day-begin day))
+ (list (- (float-time (timeclock-day-begin day))
base)))
(let ((span (timeclock-day-span day))
(len (timeclock-day-length day))
@@ -1320,8 +1317,7 @@ HTML-P is non-nil, HTML markup is added."
(when (and (> span 0)
(> (/ (float len) (float span)) 0.70))
(nconc (aref time-out i)
- (list (- (timeclock-time-to-seconds
- (timeclock-day-end day))
+ (list (- (float-time (timeclock-day-end day))
base)))
(nconc (aref breaks i) (list (- span len))))
(if req
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 7a914da3977..3d1b060494b 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -2460,7 +2460,7 @@ To be used in the ERT results buffer."
stats)
for end-time across (ert--stats-test-end-times stats)
collect (list test
- (float-time (subtract-time
+ (float-time (time-subtract
end-time start-time))))))
(setq data (sort data (lambda (a b)
(> (cl-second a) (cl-second b)))))
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index b20a6c9e966..8501e2cba7d 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -6007,10 +6007,8 @@ Returns a list of the form (HIGH LOW), compatible with Emacs time format."
(list (truncate (/ n 65536))
(truncate (mod n 65536)))))
-(defalias 'erc-emacs-time-to-erc-time
- (if (featurep 'xemacs) 'time-to-seconds 'float-time))
-
-(defalias 'erc-current-time 'erc-emacs-time-to-erc-time)
+(defalias 'erc-emacs-time-to-erc-time 'float-time)
+(defalias 'erc-current-time 'float-time)
(defun erc-time-diff (t1 t2)
"Return the time difference in seconds between T1 and T2."
diff --git a/lisp/files.el b/lisp/files.el
index 21f7bdc7dcf..b737c101588 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3817,8 +3817,10 @@ This function returns either:
;; The entry MTIME should match the most recent
;; MTIME among matching files.
(and cached-files
- (= (time-to-seconds (nth 2 dir-elt))
- (apply #'max (mapcar (lambda (f) (time-to-seconds (nth 5 (file-attributes f))))
+ (= (float-time (nth 2 dir-elt))
+ (apply #'max (mapcar (lambda (f)
+ (float-time
+ (nth 5 (file-attributes f))))
cached-files))))))
;; This cache entry is OK.
dir-elt
@@ -3860,7 +3862,7 @@ Return the new class name, which is a symbol named DIR."
(seconds-to-time
(if success
(apply #'max (mapcar (lambda (file)
- (time-to-seconds (nth 5 (file-attributes file))))
+ (float-time (nth 5 (file-attributes file))))
files))
;; If there was a problem, use the values we could get but
;; don't let the cache prevent future reads.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index dea8d1f5c9f..c103e1cbb91 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -3596,7 +3596,7 @@ possible values."
;; If the date is seriously mangled, the timezone functions are
;; liable to bug out, so we ignore all errors.
(let* ((now (current-time))
- (real-time (subtract-time now time))
+ (real-time (time-subtract now time))
(real-sec (and real-time
(+ (* (float (car real-time)) 65536)
(cadr real-time))))
diff --git a/lisp/gnus/gnus-diary.el b/lisp/gnus/gnus-diary.el
index af278b4427d..12ca9fcad66 100644
--- a/lisp/gnus/gnus-diary.el
+++ b/lisp/gnus/gnus-diary.el
@@ -161,7 +161,7 @@ There are currently two built-in format functions:
(sched (gnus-diary-header-schedule extras))
(occur (nndiary-next-occurence sched (current-time)))
(now (current-time))
- (real-time (subtract-time occur now)))
+ (real-time (time-subtract occur now)))
(if (null real-time)
"?????"
(let* ((sec (+ (* (float (car real-time)) 65536) (cadr real-time)))
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 3de26094572..53a4ca75042 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -4530,7 +4530,7 @@ or `gnus-group-catchup-group-hook'."
"Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
(let* ((time (or (gnus-group-timestamp group)
(list 0 0)))
- (delta (subtract-time (current-time) time)))
+ (delta (time-subtract (current-time) time)))
(+ (* (nth 0 delta) 65536.0)
(nth 1 delta))))
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el
index 71229dd9394..ffe788133e4 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -1278,27 +1278,27 @@ all. This may very well take some time.")
(while (setq reminder (pop reminders))
(push
(cond ((eq (cdr reminder) 'minute)
- (subtract-time
+ (time-subtract
(apply 'encode-time 0 (nthcdr 1 date-elts))
(seconds-to-time (* (car reminder) 60.0))))
((eq (cdr reminder) 'hour)
- (subtract-time
+ (time-subtract
(apply 'encode-time 0 0 (nthcdr 2 date-elts))
(seconds-to-time (* (car reminder) 3600.0))))
((eq (cdr reminder) 'day)
- (subtract-time
+ (time-subtract
(apply 'encode-time 0 0 0 (nthcdr 3 date-elts))
(seconds-to-time (* (car reminder) 86400.0))))
((eq (cdr reminder) 'week)
- (subtract-time
+ (time-subtract
(apply 'encode-time 0 0 0 monday (nthcdr 4 date-elts))
(seconds-to-time (* (car reminder) 604800.0))))
((eq (cdr reminder) 'month)
- (subtract-time
+ (time-subtract
(apply 'encode-time 0 0 0 1 (nthcdr 4 date-elts))
(seconds-to-time (* (car reminder) 18748800.0))))
((eq (cdr reminder) 'year)
- (subtract-time
+ (time-subtract
(apply 'encode-time 0 0 0 1 1 (nthcdr 5 date-elts))
(seconds-to-time (* (car reminder) 400861056.0)))))
res))
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index 2596e56aa47..41b21722723 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -442,13 +442,6 @@ buffers *newsticker-wget-<feed>* will not be closed."
;; FIXME It is bad practice to define compat functions with such generic names.
-;; This is not needed in Emacs >= 22.1.
-(unless (fboundp 'time-add)
- (require 'time-date);;FIXME
- (defun time-add (t1 t2)
- (with-no-warnings ; don't warn about obsolete time-to-seconds in 23.2
- (seconds-to-time (+ (time-to-seconds t1) (time-to-seconds t2))))))
-
(unless (fboundp 'match-string-no-properties)
(defalias 'match-string-no-properties 'match-string))
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index f2c8c5d50c5..66e6326085c 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -611,10 +611,7 @@ If ARG is non-nil, instead prompt for connection parameters."
`(with-current-buffer rcirc-server-buffer
,@body))
-(defalias 'rcirc-float-time
- (if (featurep 'xemacs)
- 'time-to-seconds
- 'float-time))
+(define-obsolete-function-alias 'rcirc-float-time 'float-time "26.1")
(defun rcirc-prompt-for-encryption (server-plist)
"Prompt the user for the encryption method to use.
@@ -638,7 +635,7 @@ last ping."
(rcirc-send-ctcp process
rcirc-nick
(format "KEEPALIVE %f"
- (rcirc-float-time))))))
+ (float-time))))))
(rcirc-process-list))
;; no processes, clean up timer
(when (timerp rcirc-keepalive-timer)
@@ -647,7 +644,7 @@ last ping."
(defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message)
(with-rcirc-process-buffer process
- (setq header-line-format (format "%f" (- (rcirc-float-time)
+ (setq header-line-format (format "%f" (- (float-time)
(string-to-number message))))))
(defvar rcirc-debug-buffer "*rcirc debug*")
@@ -2342,7 +2339,7 @@ With a prefix arg, prompt for new topic."
(defun rcirc-ctcp-sender-PING (process target _request)
"Send a CTCP PING message to TARGET."
- (let ((timestamp (format "%.0f" (rcirc-float-time))))
+ (let ((timestamp (format "%.0f" (float-time))))
(rcirc-send-ctcp process target "PING" timestamp)))
(defun rcirc-cmd-me (args &optional process target)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index aa335d3ce02..377b529803c 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4124,7 +4124,7 @@ Invokes `password-read' if available, `read-passwd' else."
(defun tramp-time-diff (t1 t2)
"Return the difference between the two times, in seconds.
T1 and T2 are time values (as returned by `current-time' for example)."
- (float-time (subtract-time t1 t2)))
+ (float-time (time-subtract t1 t2)))
;; Currently (as of Emacs 20.5), the function `shell-quote-argument'
;; does not deal well with newline characters. Newline is replaced by
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."
(defvar org-agenda-markers nil
"List of all currently active markers created by `org-agenda'.")
-(defvar org-agenda-last-marker-time (org-float-time)
+(defvar org-agenda-last-marker-time (float-time)
"Creation time of the last agenda marker.")
(defun org-agenda-new-marker (&optional pos)
@@ -3911,7 +3911,7 @@ functions do."
Org-mode keeps a list of these markers and resets them when they are
no longer in use."
(let ((m (copy-marker (or pos (point)))))
- (setq org-agenda-last-marker-time (org-float-time))
+ (setq org-agenda-last-marker-time (float-time))
(if org-agenda-buffer
(with-current-buffer org-agenda-buffer
(push m org-agenda-markers))
@@ -5231,7 +5231,7 @@ So the example above may also be written as
The function expects the lisp variables `entry' and `date' to be provided
by the caller, because this is how the calendar works. Don't use this
function from a program - use `org-agenda-get-day-entries' instead."
- (when (> (- (org-float-time)
+ (when (> (- (float-time)
org-agenda-last-marker-time)
5)
;; 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."
(let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
(list entry)
(org-agenda-files t)))
- (time (org-float-time))
+ (time (float-time))
file rtn results)
(when (or (not org-diary-last-run-time)
(> (- time
@@ -5912,9 +5912,9 @@ See also the user option `org-agenda-clock-consistency-checks'."
(throw 'next t))
(setq ts (match-string 1)
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)))
dt (- te ts))))
(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."
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)
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'."
(when focus-follows-mouse
(set-mouse-position frame (1- (frame-width frame)) 0)))))
-(defalias 'org-float-time
- (if (featurep 'xemacs) 'time-to-seconds 'float-time))
+(define-obsolete-function-alias 'org-float-time 'float-time "26.1")
;; `user-error' is only available from 24.2.50 on
(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."
(save-excursion (re-search-forward org-ts-regexp-both
(point-at-eol) t)))
(org-time-string-to-seconds (match-string 0)))
- (t (org-float-time now))))
+ (t (float-time now))))
((= dcst ?x) (or (and (stringp (match-string 1))
(match-string 1))
""))
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."
(setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
(setq org-timer-start-time
(seconds-to-time
- (- (org-float-time) delta))))
+ (- (float-time) delta))))
(org-timer-set-mode-line 'on)
(message "Timer start time set to %s, current value is %s"
(format-time-string "%T" org-timer-start-time)
@@ -142,9 +142,9 @@ With prefix arg STOP, stop it entirely."
(setq org-timer-start-time
(seconds-to-time
(-
- (org-float-time)
- (- (org-float-time org-timer-pause-time)
- (org-float-time org-timer-start-time))))
+ (float-time)
+ (- (float-time org-timer-pause-time)
+ (float-time org-timer-start-time))))
org-timer-pause-time nil)
(org-timer-set-mode-line 'on)
(run-hooks 'org-timer-continue-hook)
@@ -194,10 +194,10 @@ it in the buffer."
(defvar org-timer-timer-is-countdown nil)
(defun org-timer-seconds ()
(if org-timer-timer-is-countdown
- (- (org-float-time org-timer-start-time)
- (org-float-time))
- (- (org-float-time org-timer-pause-time)
- (org-float-time org-timer-start-time))))
+ (- (float-time org-timer-start-time)
+ (float-time))
+ (- (float-time org-timer-pause-time)
+ (float-time org-timer-start-time))))
;;;###autoload
(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'.
;; Other stuff we need.
(require 'time-date)
-(unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
(require 'easymenu)
(require 'overlay)
@@ -5514,8 +5513,8 @@ the rounding returns a past time."
(apply 'encode-time
(append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
(nthcdr 2 time))))
- (if (and past (< (org-float-time (time-subtract (current-time) res)) 0))
- (seconds-to-time (- (org-float-time res) (* r 60)))
+ (if (and past (< (float-time (time-subtract (current-time) res)) 0))
+ (seconds-to-time (- (float-time res) (* r 60)))
res))))
(defun org-today ()
@@ -8779,24 +8778,24 @@ links."
(if (or (re-search-forward org-ts-regexp end t)
(re-search-forward org-ts-regexp-both end t))
(org-time-string-to-seconds (match-string 0))
- (org-float-time now))))
+ (float-time now))))
((= dcst ?c)
(let ((end (save-excursion (outline-next-heading) (point))))
(if (re-search-forward
(concat "^[ \t]*\\[" org-ts-regexp1 "\\]")
end t)
(org-time-string-to-seconds (match-string 0))
- (org-float-time now))))
+ (float-time now))))
((= dcst ?s)
(let ((end (save-excursion (outline-next-heading) (point))))
(if (re-search-forward org-scheduled-time-regexp end t)
(org-time-string-to-seconds (match-string 1))
- (org-float-time now))))
+ (float-time now))))
((= dcst ?d)
(let ((end (save-excursion (outline-next-heading) (point))))
(if (re-search-forward org-deadline-time-regexp end t)
(org-time-string-to-seconds (match-string 1))
- (org-float-time now))))
+ (float-time now))))
((= dcst ?p)
(if (re-search-forward org-priority-regexp (point-at-eol) t)
(string-to-char (match-string 2))
@@ -8860,7 +8859,7 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive."
(lambda (x)
(if (or (string-match org-ts-regexp x)
(string-match org-ts-regexp-both x))
- (org-float-time
+ (float-time
(org-time-string-to-time (match-string 0 x)))
0))
comparefun (if (= dcst sorting-type) '< '>)))
@@ -16886,7 +16885,7 @@ Don't touch the rest."
(defun org-time-stamp-to-now (timestamp-string &optional seconds)
"Difference between TIMESTAMP-STRING and now in days.
If SECONDS is non-nil, return the difference in seconds."
- (let ((fdiff (if seconds 'org-float-time 'time-to-days)))
+ (let ((fdiff (if seconds 'float-time 'time-to-days)))
(- (funcall fdiff (org-time-string-to-time timestamp-string))
(funcall fdiff (current-time)))))
@@ -17041,8 +17040,8 @@ days in order to avoid rounding problems."
(match-end (match-end 0))
(time1 (org-time-string-to-time ts1))
(time2 (org-time-string-to-time ts2))
- (t1 (org-float-time time1))
- (t2 (org-float-time time2))
+ (t1 (float-time time1))
+ (t2 (float-time time2))
(diff (abs (- t2 t1)))
(negative (< (- t2 t1) 0))
;; (ys (floor (* 365 24 60 60)))
@@ -17107,7 +17106,7 @@ days in order to avoid rounding problems."
(defun org-time-string-to-seconds (s)
"Convert a timestamp string to a number of seconds."
- (org-float-time (org-time-string-to-time s)))
+ (float-time (org-time-string-to-time s)))
(defun org-time-string-to-absolute (s &optional daynr prefer show-all buffer pos)
"Convert a time stamp to an absolute day number.