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.
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")
(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)
(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)
(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)
(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
"\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)))
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."
(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."
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))
(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)
(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
<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)))
(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))
(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
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)))))
(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."
;; 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
(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.
;; 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))))
(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)))
"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))))
(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))
;; 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))
`(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.
(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)
(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*")
(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)
(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
(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)
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))
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
(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
(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
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)
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))
(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))
(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)))))))))))
"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 ()
(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))))
(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)))
(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))
(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))
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))
;; 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)
(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)
((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)
(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)
(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)
(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))
""))
(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)
(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)
(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)
;; Other stuff we need.
(require 'time-date)
-(unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
(require 'easymenu)
(require 'overlay)
(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 ()
(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))
(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) '< '>)))
(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)))))
(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)))
(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.
(character-fold-to-regexp string)))
(with-temp-buffer
(save-excursion (insert string))
- (let ((time (time-to-seconds (current-time))))
+ (let ((time (float-time)))
;; Our initial implementation of case-folding in char-folding
;; created a lot of redundant paths in the regexp. Because of
;; that, if a really long string "almost" matches, the regexp
;; engine took a long time to realize that it doesn't match.
(should-not (character-fold-search-forward (concat string "c") nil 'noerror))
;; Ensure it took less than a second.
- (should (< (- (time-to-seconds (current-time))
- time)
- 1))))))
+ (should (< (- (float-time) time) 1))))))
(provide 'character-fold-tests)
;;; character-fold-tests.el ends here