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 | |
| 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.
| -rw-r--r-- | lisp/calendar/time-date.el | 104 | ||||
| -rw-r--r-- | lisp/calendar/timeclock.el | 60 | ||||
| -rw-r--r-- | lisp/emacs-lisp/ert.el | 2 | ||||
| -rw-r--r-- | lisp/erc/erc.el | 6 | ||||
| -rw-r--r-- | lisp/files.el | 8 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-diary.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-group.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/nndiary.el | 12 | ||||
| -rw-r--r-- | lisp/net/newst-backend.el | 7 | ||||
| -rw-r--r-- | lisp/net/rcirc.el | 11 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 2 | ||||
| -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 | ||||
| -rw-r--r-- | test/lisp/character-fold-tests.el | 6 |
19 files changed, 118 insertions, 220 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). | |||
| 126 | 126 | ||
| 127 | For backward compatibility, if only four arguments are given, | 127 | For backward compatibility, if only four arguments are given, |
| 128 | it is assumed that PICO was omitted and should be treated as zero." | 128 | it is assumed that PICO was omitted and should be treated as zero." |
| 129 | (when (null type) | ||
| 130 | (setq type pico) | ||
| 131 | (setq pico 0)) | ||
| 129 | (cond | 132 | (cond |
| 130 | ((eq type 0) (cons high low)) | 133 | ((eq type 0) (cons high low)) |
| 131 | ((eq type 1) (list high low)) | 134 | ((eq type 1) (list high low)) |
| 132 | ((eq type 2) (list high low micro)) | 135 | ((eq type 2) (list high low micro)) |
| 133 | ((eq type 3) (list high low micro pico)) | 136 | ((eq type 3) (list high low micro pico)))) |
| 134 | ((null type) (encode-time-value high low micro 0 pico)))) | ||
| 135 | 137 | ||
| 136 | (when (and (fboundp 'time-add) (subrp (symbol-function 'time-add))) | 138 | (make-obsolete 'encode-time-value nil "25.1") |
| 137 | (make-obsolete 'encode-time-value nil "25.1") | 139 | (make-obsolete 'with-decoded-time-value nil "25.1") |
| 138 | (make-obsolete 'with-decoded-time-value nil "25.1")) | ||
| 139 | 140 | ||
| 140 | (autoload 'parse-time-string "parse-time") | 141 | (autoload 'parse-time-string "parse-time") |
| 141 | (autoload 'timezone-make-date-arpa-standard "timezone") | 142 | (autoload 'timezone-make-date-arpa-standard "timezone") |
| @@ -163,27 +164,8 @@ If DATE lacks timezone information, GMT is assumed." | |||
| 163 | (apply 'signal err) | 164 | (apply 'signal err) |
| 164 | (error "Invalid date: %s" date))))))))) | 165 | (error "Invalid date: %s" date))))))))) |
| 165 | 166 | ||
| 166 | ;; Bit of a mess. Emacs has float-time since at least 21.1. | 167 | ;;;###autoload |
| 167 | ;; This file is synced to Gnus, and XEmacs packages may have been written | 168 | (defalias 'time-to-seconds 'float-time) |
| 168 | ;; using time-to-seconds from the Gnus library. | ||
| 169 | ;;;###autoload(if (or (featurep 'emacs) | ||
| 170 | ;;;###autoload (and (fboundp 'float-time) | ||
| 171 | ;;;###autoload (subrp (symbol-function 'float-time)))) | ||
| 172 | ;;;###autoload (defalias 'time-to-seconds 'float-time) | ||
| 173 | ;;;###autoload (autoload 'time-to-seconds "time-date")) | ||
| 174 | |||
| 175 | (eval-when-compile | ||
| 176 | (or (featurep 'emacs) | ||
| 177 | (and (fboundp 'float-time) | ||
| 178 | (subrp (symbol-function 'float-time))) | ||
| 179 | (defun time-to-seconds (&optional time) | ||
| 180 | "Convert optional value TIME to a floating point number. | ||
| 181 | TIME defaults to the current time." | ||
| 182 | (with-decoded-time-value ((high low micro pico _type | ||
| 183 | (or time (current-time)))) | ||
| 184 | (+ (* high 65536.0) | ||
| 185 | low | ||
| 186 | (/ (+ (* micro 1e6) pico) 1e12)))))) | ||
| 187 | 169 | ||
| 188 | ;;;###autoload | 170 | ;;;###autoload |
| 189 | (defun seconds-to-time (seconds) | 171 | (defun seconds-to-time (seconds) |
| @@ -209,68 +191,7 @@ TIME should be either a time value or a date-time string." | |||
| 209 | (time-subtract nil time)) | 191 | (time-subtract nil time)) |
| 210 | 192 | ||
| 211 | ;;;###autoload | 193 | ;;;###autoload |
| 212 | (defalias 'subtract-time 'time-subtract) | 194 | (define-obsolete-function-alias 'subtract-time 'time-subtract "26.1") |
| 213 | |||
| 214 | ;; These autoloads do nothing in Emacs 25, where the functions are builtin. | ||
| 215 | ;;;###autoload(autoload 'time-add "time-date") | ||
| 216 | ;;;###autoload(autoload 'time-subtract "time-date") | ||
| 217 | ;;;###autoload(autoload 'time-less-p "time-date") | ||
| 218 | |||
| 219 | (eval-and-compile | ||
| 220 | (when (not (and (fboundp 'time-add) (subrp (symbol-function 'time-add)))) | ||
| 221 | |||
| 222 | (defun time-add (t1 t2) | ||
| 223 | "Add two time values T1 and T2. One should represent a time difference." | ||
| 224 | (with-decoded-time-value ((high low micro pico type t1) | ||
| 225 | (high2 low2 micro2 pico2 type2 t2)) | ||
| 226 | (setq high (+ high high2) | ||
| 227 | low (+ low low2) | ||
| 228 | micro (+ micro micro2) | ||
| 229 | pico (+ pico pico2) | ||
| 230 | type (max type type2)) | ||
| 231 | (when (>= pico 1000000) | ||
| 232 | (setq micro (1+ micro) | ||
| 233 | pico (- pico 1000000))) | ||
| 234 | (when (>= micro 1000000) | ||
| 235 | (setq low (1+ low) | ||
| 236 | micro (- micro 1000000))) | ||
| 237 | (when (>= low 65536) | ||
| 238 | (setq high (1+ high) | ||
| 239 | low (- low 65536))) | ||
| 240 | (encode-time-value high low micro pico type))) | ||
| 241 | |||
| 242 | (defun time-subtract (t1 t2) | ||
| 243 | "Subtract two time values, T1 minus T2. | ||
| 244 | Return the difference in the format of a time value." | ||
| 245 | (with-decoded-time-value ((high low micro pico type t1) | ||
| 246 | (high2 low2 micro2 pico2 type2 t2)) | ||
| 247 | (setq high (- high high2) | ||
| 248 | low (- low low2) | ||
| 249 | micro (- micro micro2) | ||
| 250 | pico (- pico pico2) | ||
| 251 | type (max type type2)) | ||
| 252 | (when (< pico 0) | ||
| 253 | (setq micro (1- micro) | ||
| 254 | pico (+ pico 1000000))) | ||
| 255 | (when (< micro 0) | ||
| 256 | (setq low (1- low) | ||
| 257 | micro (+ micro 1000000))) | ||
| 258 | (when (< low 0) | ||
| 259 | (setq high (1- high) | ||
| 260 | low (+ low 65536))) | ||
| 261 | (encode-time-value high low micro pico type))) | ||
| 262 | |||
| 263 | (defun time-less-p (t1 t2) | ||
| 264 | "Return non-nil if time value T1 is earlier than time value T2." | ||
| 265 | (with-decoded-time-value ((high1 low1 micro1 pico1 _type1 t1) | ||
| 266 | (high2 low2 micro2 pico2 _type2 t2)) | ||
| 267 | (or (< high1 high2) | ||
| 268 | (and (= high1 high2) | ||
| 269 | (or (< low1 low2) | ||
| 270 | (and (= low1 low2) | ||
| 271 | (or (< micro1 micro2) | ||
| 272 | (and (= micro1 micro2) | ||
| 273 | (< pico1 pico2))))))))))) | ||
| 274 | 195 | ||
| 275 | ;;;###autoload | 196 | ;;;###autoload |
| 276 | (defun date-to-day (date) | 197 | (defun date-to-day (date) |
| @@ -324,12 +245,7 @@ The Gregorian date Sunday, December 31, 1bce is imaginary." | |||
| 324 | (defun time-to-number-of-days (time) | 245 | (defun time-to-number-of-days (time) |
| 325 | "Return the number of days represented by TIME. | 246 | "Return the number of days represented by TIME. |
| 326 | Returns a floating point number." | 247 | Returns a floating point number." |
| 327 | (/ (funcall (eval-when-compile | 248 | (/ (float-time time) (* 60 60 24))) |
| 328 | (if (or (featurep 'emacs) | ||
| 329 | (and (fboundp 'float-time) | ||
| 330 | (subrp (symbol-function 'float-time)))) | ||
| 331 | 'float-time | ||
| 332 | 'time-to-seconds)) time) (* 60 60 24))) | ||
| 333 | 249 | ||
| 334 | ;;;###autoload | 250 | ;;;###autoload |
| 335 | (defun safe-date-to-time (date) | 251 | (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." | |||
| 532 | (message "%s" string) | 532 | (message "%s" string) |
| 533 | string))) | 533 | string))) |
| 534 | 534 | ||
| 535 | (defalias 'timeclock-time-to-seconds (if (fboundp 'float-time) 'float-time | 535 | (define-obsolete-function-alias 'timeclock-time-to-seconds 'float-time "26.1") |
| 536 | 'time-to-seconds)) | 536 | (define-obsolete-function-alias 'timeclock-seconds-to-time 'seconds-to-time |
| 537 | 537 | "26.1") | |
| 538 | (defalias 'timeclock-seconds-to-time 'seconds-to-time) | ||
| 539 | 538 | ||
| 540 | ;; Should today-only be removed in favor of timeclock-relative? - gm | 539 | ;; Should today-only be removed in favor of timeclock-relative? - gm |
| 541 | (defsubst timeclock-when-to-leave (&optional today-only) | 540 | (defsubst timeclock-when-to-leave (&optional today-only) |
| 542 | "Return a time value representing the end of today's workday. | 541 | "Return a time value representing the end of today's workday. |
| 543 | If TODAY-ONLY is non-nil, the value returned will be relative only to | 542 | If TODAY-ONLY is non-nil, the value returned will be relative only to |
| 544 | the time worked today, and not to past time." | 543 | the time worked today, and not to past time." |
| 545 | (timeclock-seconds-to-time | 544 | (seconds-to-time |
| 546 | (- (timeclock-time-to-seconds) | 545 | (- (float-time) |
| 547 | (let ((discrep (timeclock-find-discrep))) | 546 | (let ((discrep (timeclock-find-discrep))) |
| 548 | (if discrep | 547 | (if discrep |
| 549 | (if today-only | 548 | (if today-only |
| @@ -686,9 +685,8 @@ being logged for. Normally only \"in\" events specify a project." | |||
| 686 | "\n") | 685 | "\n") |
| 687 | (if (equal (downcase code) "o") | 686 | (if (equal (downcase code) "o") |
| 688 | (setq timeclock-last-period | 687 | (setq timeclock-last-period |
| 689 | (- (timeclock-time-to-seconds now) | 688 | (- (float-time now) |
| 690 | (timeclock-time-to-seconds | 689 | (float-time (cadr timeclock-last-event))) |
| 691 | (cadr timeclock-last-event))) | ||
| 692 | timeclock-discrepancy | 690 | timeclock-discrepancy |
| 693 | (+ timeclock-discrepancy | 691 | (+ timeclock-discrepancy |
| 694 | timeclock-last-period))) | 692 | timeclock-last-period))) |
| @@ -723,14 +721,14 @@ recorded to disk. If MOMENT is non-nil, use that as the current time. | |||
| 723 | This is only provided for coherency when used by | 721 | This is only provided for coherency when used by |
| 724 | `timeclock-discrepancy'." | 722 | `timeclock-discrepancy'." |
| 725 | (if (equal (car timeclock-last-event) "i") | 723 | (if (equal (car timeclock-last-event) "i") |
| 726 | (- (timeclock-time-to-seconds moment) | 724 | (- (float-time moment) |
| 727 | (timeclock-time-to-seconds (cadr timeclock-last-event))) | 725 | (float-time (cadr timeclock-last-event))) |
| 728 | timeclock-last-period)) | 726 | timeclock-last-period)) |
| 729 | 727 | ||
| 730 | (defsubst timeclock-entry-length (entry) | 728 | (defsubst timeclock-entry-length (entry) |
| 731 | "Return the length of ENTRY in seconds." | 729 | "Return the length of ENTRY in seconds." |
| 732 | (- (timeclock-time-to-seconds (cadr entry)) | 730 | (- (float-time (cadr entry)) |
| 733 | (timeclock-time-to-seconds (car entry)))) | 731 | (float-time (car entry)))) |
| 734 | 732 | ||
| 735 | (defsubst timeclock-entry-begin (entry) | 733 | (defsubst timeclock-entry-begin (entry) |
| 736 | "Return the start time of ENTRY." | 734 | "Return the start time of ENTRY." |
| @@ -765,8 +763,8 @@ This is only provided for coherency when used by | |||
| 765 | 763 | ||
| 766 | (defsubst timeclock-entry-list-span (entry-list) | 764 | (defsubst timeclock-entry-list-span (entry-list) |
| 767 | "Return the total time in seconds spanned by ENTRY-LIST." | 765 | "Return the total time in seconds spanned by ENTRY-LIST." |
| 768 | (- (timeclock-time-to-seconds (timeclock-entry-list-end entry-list)) | 766 | (- (float-time (timeclock-entry-list-end entry-list)) |
| 769 | (timeclock-time-to-seconds (timeclock-entry-list-begin entry-list)))) | 767 | (float-time (timeclock-entry-list-begin entry-list)))) |
| 770 | 768 | ||
| 771 | (defsubst timeclock-entry-list-break (entry-list) | 769 | (defsubst timeclock-entry-list-break (entry-list) |
| 772 | "Return the total break time (span - length) in ENTRY-LIST." | 770 | "Return the total break time (span - length) in ENTRY-LIST." |
| @@ -1137,7 +1135,7 @@ discrepancy, today's discrepancy, and the time worked today." | |||
| 1137 | last-date-limited nil) | 1135 | last-date-limited nil) |
| 1138 | (if beg | 1136 | (if beg |
| 1139 | (error "Error in format of timelog file!") | 1137 | (error "Error in format of timelog file!") |
| 1140 | (setq beg (timeclock-time-to-seconds (cadr event)))))) | 1138 | (setq beg (float-time (cadr event)))))) |
| 1141 | ((equal (downcase (car event)) "o") | 1139 | ((equal (downcase (car event)) "o") |
| 1142 | (if (and (nth 2 event) | 1140 | (if (and (nth 2 event) |
| 1143 | (> (length (nth 2 event)) 0)) | 1141 | (> (length (nth 2 event)) 0)) |
| @@ -1145,7 +1143,7 @@ discrepancy, today's discrepancy, and the time worked today." | |||
| 1145 | (if (not beg) | 1143 | (if (not beg) |
| 1146 | (error "Error in format of timelog file!") | 1144 | (error "Error in format of timelog file!") |
| 1147 | (setq timeclock-last-period | 1145 | (setq timeclock-last-period |
| 1148 | (- (timeclock-time-to-seconds (cadr event)) beg) | 1146 | (- (float-time (cadr event)) beg) |
| 1149 | accum (+ timeclock-last-period accum) | 1147 | accum (+ timeclock-last-period accum) |
| 1150 | beg nil)) | 1148 | beg nil)) |
| 1151 | (if (equal last-date todays-date) | 1149 | (if (equal last-date todays-date) |
| @@ -1225,8 +1223,8 @@ HTML-P is non-nil, HTML markup is added." | |||
| 1225 | (insert project "</b><br>\n") | 1223 | (insert project "</b><br>\n") |
| 1226 | (insert project "*\n")) | 1224 | (insert project "*\n")) |
| 1227 | (let ((proj-data (cdr (assoc project (timeclock-project-alist log)))) | 1225 | (let ((proj-data (cdr (assoc project (timeclock-project-alist log)))) |
| 1228 | (two-weeks-ago (timeclock-seconds-to-time | 1226 | (two-weeks-ago (seconds-to-time |
| 1229 | (- (timeclock-time-to-seconds today) | 1227 | (- (float-time today) |
| 1230 | (* 2 7 24 60 60)))) | 1228 | (* 2 7 24 60 60)))) |
| 1231 | two-week-len today-len) | 1229 | two-week-len today-len) |
| 1232 | (while proj-data | 1230 | (while proj-data |
| @@ -1278,17 +1276,17 @@ HTML-P is non-nil, HTML markup is added." | |||
| 1278 | <th>-1 year</th> | 1276 | <th>-1 year</th> |
| 1279 | </tr>") | 1277 | </tr>") |
| 1280 | (let* ((day-list (timeclock-day-list)) | 1278 | (let* ((day-list (timeclock-day-list)) |
| 1281 | (thirty-days-ago (timeclock-seconds-to-time | 1279 | (thirty-days-ago (seconds-to-time |
| 1282 | (- (timeclock-time-to-seconds today) | 1280 | (- (float-time today) |
| 1283 | (* 30 24 60 60)))) | 1281 | (* 30 24 60 60)))) |
| 1284 | (three-months-ago (timeclock-seconds-to-time | 1282 | (three-months-ago (seconds-to-time |
| 1285 | (- (timeclock-time-to-seconds today) | 1283 | (- (float-time today) |
| 1286 | (* 90 24 60 60)))) | 1284 | (* 90 24 60 60)))) |
| 1287 | (six-months-ago (timeclock-seconds-to-time | 1285 | (six-months-ago (seconds-to-time |
| 1288 | (- (timeclock-time-to-seconds today) | 1286 | (- (float-time today) |
| 1289 | (* 180 24 60 60)))) | 1287 | (* 180 24 60 60)))) |
| 1290 | (one-year-ago (timeclock-seconds-to-time | 1288 | (one-year-ago (seconds-to-time |
| 1291 | (- (timeclock-time-to-seconds today) | 1289 | (- (float-time today) |
| 1292 | (* 365 24 60 60)))) | 1290 | (* 365 24 60 60)))) |
| 1293 | (time-in (vector (list t) (list t) (list t) (list t) (list t))) | 1291 | (time-in (vector (list t) (list t) (list t) (list t) (list t))) |
| 1294 | (time-out (vector (list t) (list t) (list t) (list t) (list t))) | 1292 | (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." | |||
| 1303 | (unless (time-less-p | 1301 | (unless (time-less-p |
| 1304 | (timeclock-day-begin day) | 1302 | (timeclock-day-begin day) |
| 1305 | (aref lengths i)) | 1303 | (aref lengths i)) |
| 1306 | (let ((base (timeclock-time-to-seconds | 1304 | (let ((base (float-time |
| 1307 | (timeclock-day-base | 1305 | (timeclock-day-base |
| 1308 | (timeclock-day-begin day))))) | 1306 | (timeclock-day-begin day))))) |
| 1309 | (nconc (aref time-in i) | 1307 | (nconc (aref time-in i) |
| 1310 | (list (- (timeclock-time-to-seconds | 1308 | (list (- (float-time (timeclock-day-begin day)) |
| 1311 | (timeclock-day-begin day)) | ||
| 1312 | base))) | 1309 | base))) |
| 1313 | (let ((span (timeclock-day-span day)) | 1310 | (let ((span (timeclock-day-span day)) |
| 1314 | (len (timeclock-day-length day)) | 1311 | (len (timeclock-day-length day)) |
| @@ -1320,8 +1317,7 @@ HTML-P is non-nil, HTML markup is added." | |||
| 1320 | (when (and (> span 0) | 1317 | (when (and (> span 0) |
| 1321 | (> (/ (float len) (float span)) 0.70)) | 1318 | (> (/ (float len) (float span)) 0.70)) |
| 1322 | (nconc (aref time-out i) | 1319 | (nconc (aref time-out i) |
| 1323 | (list (- (timeclock-time-to-seconds | 1320 | (list (- (float-time (timeclock-day-end day)) |
| 1324 | (timeclock-day-end day)) | ||
| 1325 | base))) | 1321 | base))) |
| 1326 | (nconc (aref breaks i) (list (- span len)))) | 1322 | (nconc (aref breaks i) (list (- span len)))) |
| 1327 | (if req | 1323 | (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." | |||
| 2460 | stats) | 2460 | stats) |
| 2461 | for end-time across (ert--stats-test-end-times stats) | 2461 | for end-time across (ert--stats-test-end-times stats) |
| 2462 | collect (list test | 2462 | collect (list test |
| 2463 | (float-time (subtract-time | 2463 | (float-time (time-subtract |
| 2464 | end-time start-time)))))) | 2464 | end-time start-time)))))) |
| 2465 | (setq data (sort data (lambda (a b) | 2465 | (setq data (sort data (lambda (a b) |
| 2466 | (> (cl-second a) (cl-second b))))) | 2466 | (> (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." | |||
| 6007 | (list (truncate (/ n 65536)) | 6007 | (list (truncate (/ n 65536)) |
| 6008 | (truncate (mod n 65536))))) | 6008 | (truncate (mod n 65536))))) |
| 6009 | 6009 | ||
| 6010 | (defalias 'erc-emacs-time-to-erc-time | 6010 | (defalias 'erc-emacs-time-to-erc-time 'float-time) |
| 6011 | (if (featurep 'xemacs) 'time-to-seconds 'float-time)) | 6011 | (defalias 'erc-current-time 'float-time) |
| 6012 | |||
| 6013 | (defalias 'erc-current-time 'erc-emacs-time-to-erc-time) | ||
| 6014 | 6012 | ||
| 6015 | (defun erc-time-diff (t1 t2) | 6013 | (defun erc-time-diff (t1 t2) |
| 6016 | "Return the time difference in seconds between T1 and T2." | 6014 | "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: | |||
| 3817 | ;; The entry MTIME should match the most recent | 3817 | ;; The entry MTIME should match the most recent |
| 3818 | ;; MTIME among matching files. | 3818 | ;; MTIME among matching files. |
| 3819 | (and cached-files | 3819 | (and cached-files |
| 3820 | (= (time-to-seconds (nth 2 dir-elt)) | 3820 | (= (float-time (nth 2 dir-elt)) |
| 3821 | (apply #'max (mapcar (lambda (f) (time-to-seconds (nth 5 (file-attributes f)))) | 3821 | (apply #'max (mapcar (lambda (f) |
| 3822 | (float-time | ||
| 3823 | (nth 5 (file-attributes f)))) | ||
| 3822 | cached-files)))))) | 3824 | cached-files)))))) |
| 3823 | ;; This cache entry is OK. | 3825 | ;; This cache entry is OK. |
| 3824 | dir-elt | 3826 | dir-elt |
| @@ -3860,7 +3862,7 @@ Return the new class name, which is a symbol named DIR." | |||
| 3860 | (seconds-to-time | 3862 | (seconds-to-time |
| 3861 | (if success | 3863 | (if success |
| 3862 | (apply #'max (mapcar (lambda (file) | 3864 | (apply #'max (mapcar (lambda (file) |
| 3863 | (time-to-seconds (nth 5 (file-attributes file)))) | 3865 | (float-time (nth 5 (file-attributes file)))) |
| 3864 | files)) | 3866 | files)) |
| 3865 | ;; If there was a problem, use the values we could get but | 3867 | ;; If there was a problem, use the values we could get but |
| 3866 | ;; don't let the cache prevent future reads. | 3868 | ;; 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." | |||
| 3596 | ;; If the date is seriously mangled, the timezone functions are | 3596 | ;; If the date is seriously mangled, the timezone functions are |
| 3597 | ;; liable to bug out, so we ignore all errors. | 3597 | ;; liable to bug out, so we ignore all errors. |
| 3598 | (let* ((now (current-time)) | 3598 | (let* ((now (current-time)) |
| 3599 | (real-time (subtract-time now time)) | 3599 | (real-time (time-subtract now time)) |
| 3600 | (real-sec (and real-time | 3600 | (real-sec (and real-time |
| 3601 | (+ (* (float (car real-time)) 65536) | 3601 | (+ (* (float (car real-time)) 65536) |
| 3602 | (cadr real-time)))) | 3602 | (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: | |||
| 161 | (sched (gnus-diary-header-schedule extras)) | 161 | (sched (gnus-diary-header-schedule extras)) |
| 162 | (occur (nndiary-next-occurence sched (current-time))) | 162 | (occur (nndiary-next-occurence sched (current-time))) |
| 163 | (now (current-time)) | 163 | (now (current-time)) |
| 164 | (real-time (subtract-time occur now))) | 164 | (real-time (time-subtract occur now))) |
| 165 | (if (null real-time) | 165 | (if (null real-time) |
| 166 | "?????" | 166 | "?????" |
| 167 | (let* ((sec (+ (* (float (car real-time)) 65536) (cadr real-time))) | 167 | (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'." | |||
| 4530 | "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number." | 4530 | "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number." |
| 4531 | (let* ((time (or (gnus-group-timestamp group) | 4531 | (let* ((time (or (gnus-group-timestamp group) |
| 4532 | (list 0 0))) | 4532 | (list 0 0))) |
| 4533 | (delta (subtract-time (current-time) time))) | 4533 | (delta (time-subtract (current-time) time))) |
| 4534 | (+ (* (nth 0 delta) 65536.0) | 4534 | (+ (* (nth 0 delta) 65536.0) |
| 4535 | (nth 1 delta)))) | 4535 | (nth 1 delta)))) |
| 4536 | 4536 | ||
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.") | |||
| 1278 | (while (setq reminder (pop reminders)) | 1278 | (while (setq reminder (pop reminders)) |
| 1279 | (push | 1279 | (push |
| 1280 | (cond ((eq (cdr reminder) 'minute) | 1280 | (cond ((eq (cdr reminder) 'minute) |
| 1281 | (subtract-time | 1281 | (time-subtract |
| 1282 | (apply 'encode-time 0 (nthcdr 1 date-elts)) | 1282 | (apply 'encode-time 0 (nthcdr 1 date-elts)) |
| 1283 | (seconds-to-time (* (car reminder) 60.0)))) | 1283 | (seconds-to-time (* (car reminder) 60.0)))) |
| 1284 | ((eq (cdr reminder) 'hour) | 1284 | ((eq (cdr reminder) 'hour) |
| 1285 | (subtract-time | 1285 | (time-subtract |
| 1286 | (apply 'encode-time 0 0 (nthcdr 2 date-elts)) | 1286 | (apply 'encode-time 0 0 (nthcdr 2 date-elts)) |
| 1287 | (seconds-to-time (* (car reminder) 3600.0)))) | 1287 | (seconds-to-time (* (car reminder) 3600.0)))) |
| 1288 | ((eq (cdr reminder) 'day) | 1288 | ((eq (cdr reminder) 'day) |
| 1289 | (subtract-time | 1289 | (time-subtract |
| 1290 | (apply 'encode-time 0 0 0 (nthcdr 3 date-elts)) | 1290 | (apply 'encode-time 0 0 0 (nthcdr 3 date-elts)) |
| 1291 | (seconds-to-time (* (car reminder) 86400.0)))) | 1291 | (seconds-to-time (* (car reminder) 86400.0)))) |
| 1292 | ((eq (cdr reminder) 'week) | 1292 | ((eq (cdr reminder) 'week) |
| 1293 | (subtract-time | 1293 | (time-subtract |
| 1294 | (apply 'encode-time 0 0 0 monday (nthcdr 4 date-elts)) | 1294 | (apply 'encode-time 0 0 0 monday (nthcdr 4 date-elts)) |
| 1295 | (seconds-to-time (* (car reminder) 604800.0)))) | 1295 | (seconds-to-time (* (car reminder) 604800.0)))) |
| 1296 | ((eq (cdr reminder) 'month) | 1296 | ((eq (cdr reminder) 'month) |
| 1297 | (subtract-time | 1297 | (time-subtract |
| 1298 | (apply 'encode-time 0 0 0 1 (nthcdr 4 date-elts)) | 1298 | (apply 'encode-time 0 0 0 1 (nthcdr 4 date-elts)) |
| 1299 | (seconds-to-time (* (car reminder) 18748800.0)))) | 1299 | (seconds-to-time (* (car reminder) 18748800.0)))) |
| 1300 | ((eq (cdr reminder) 'year) | 1300 | ((eq (cdr reminder) 'year) |
| 1301 | (subtract-time | 1301 | (time-subtract |
| 1302 | (apply 'encode-time 0 0 0 1 1 (nthcdr 5 date-elts)) | 1302 | (apply 'encode-time 0 0 0 1 1 (nthcdr 5 date-elts)) |
| 1303 | (seconds-to-time (* (car reminder) 400861056.0))))) | 1303 | (seconds-to-time (* (car reminder) 400861056.0))))) |
| 1304 | res)) | 1304 | 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." | |||
| 442 | 442 | ||
| 443 | ;; FIXME It is bad practice to define compat functions with such generic names. | 443 | ;; FIXME It is bad practice to define compat functions with such generic names. |
| 444 | 444 | ||
| 445 | ;; This is not needed in Emacs >= 22.1. | ||
| 446 | (unless (fboundp 'time-add) | ||
| 447 | (require 'time-date);;FIXME | ||
| 448 | (defun time-add (t1 t2) | ||
| 449 | (with-no-warnings ; don't warn about obsolete time-to-seconds in 23.2 | ||
| 450 | (seconds-to-time (+ (time-to-seconds t1) (time-to-seconds t2)))))) | ||
| 451 | |||
| 452 | (unless (fboundp 'match-string-no-properties) | 445 | (unless (fboundp 'match-string-no-properties) |
| 453 | (defalias 'match-string-no-properties 'match-string)) | 446 | (defalias 'match-string-no-properties 'match-string)) |
| 454 | 447 | ||
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." | |||
| 611 | `(with-current-buffer rcirc-server-buffer | 611 | `(with-current-buffer rcirc-server-buffer |
| 612 | ,@body)) | 612 | ,@body)) |
| 613 | 613 | ||
| 614 | (defalias 'rcirc-float-time | 614 | (define-obsolete-function-alias 'rcirc-float-time 'float-time "26.1") |
| 615 | (if (featurep 'xemacs) | ||
| 616 | 'time-to-seconds | ||
| 617 | 'float-time)) | ||
| 618 | 615 | ||
| 619 | (defun rcirc-prompt-for-encryption (server-plist) | 616 | (defun rcirc-prompt-for-encryption (server-plist) |
| 620 | "Prompt the user for the encryption method to use. | 617 | "Prompt the user for the encryption method to use. |
| @@ -638,7 +635,7 @@ last ping." | |||
| 638 | (rcirc-send-ctcp process | 635 | (rcirc-send-ctcp process |
| 639 | rcirc-nick | 636 | rcirc-nick |
| 640 | (format "KEEPALIVE %f" | 637 | (format "KEEPALIVE %f" |
| 641 | (rcirc-float-time)))))) | 638 | (float-time)))))) |
| 642 | (rcirc-process-list)) | 639 | (rcirc-process-list)) |
| 643 | ;; no processes, clean up timer | 640 | ;; no processes, clean up timer |
| 644 | (when (timerp rcirc-keepalive-timer) | 641 | (when (timerp rcirc-keepalive-timer) |
| @@ -647,7 +644,7 @@ last ping." | |||
| 647 | 644 | ||
| 648 | (defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message) | 645 | (defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message) |
| 649 | (with-rcirc-process-buffer process | 646 | (with-rcirc-process-buffer process |
| 650 | (setq header-line-format (format "%f" (- (rcirc-float-time) | 647 | (setq header-line-format (format "%f" (- (float-time) |
| 651 | (string-to-number message)))))) | 648 | (string-to-number message)))))) |
| 652 | 649 | ||
| 653 | (defvar rcirc-debug-buffer "*rcirc debug*") | 650 | (defvar rcirc-debug-buffer "*rcirc debug*") |
| @@ -2342,7 +2339,7 @@ With a prefix arg, prompt for new topic." | |||
| 2342 | 2339 | ||
| 2343 | (defun rcirc-ctcp-sender-PING (process target _request) | 2340 | (defun rcirc-ctcp-sender-PING (process target _request) |
| 2344 | "Send a CTCP PING message to TARGET." | 2341 | "Send a CTCP PING message to TARGET." |
| 2345 | (let ((timestamp (format "%.0f" (rcirc-float-time)))) | 2342 | (let ((timestamp (format "%.0f" (float-time)))) |
| 2346 | (rcirc-send-ctcp process target "PING" timestamp))) | 2343 | (rcirc-send-ctcp process target "PING" timestamp))) |
| 2347 | 2344 | ||
| 2348 | (defun rcirc-cmd-me (args &optional process target) | 2345 | (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." | |||
| 4124 | (defun tramp-time-diff (t1 t2) | 4124 | (defun tramp-time-diff (t1 t2) |
| 4125 | "Return the difference between the two times, in seconds. | 4125 | "Return the difference between the two times, in seconds. |
| 4126 | T1 and T2 are time values (as returned by `current-time' for example)." | 4126 | T1 and T2 are time values (as returned by `current-time' for example)." |
| 4127 | (float-time (subtract-time t1 t2))) | 4127 | (float-time (time-subtract t1 t2))) |
| 4128 | 4128 | ||
| 4129 | ;; Currently (as of Emacs 20.5), the function `shell-quote-argument' | 4129 | ;; Currently (as of Emacs 20.5), the function `shell-quote-argument' |
| 4130 | ;; does not deal well with newline characters. Newline is replaced by | 4130 | ;; 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." | |||
| 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. |
diff --git a/test/lisp/character-fold-tests.el b/test/lisp/character-fold-tests.el index c611217712e..dc7e9270551 100644 --- a/test/lisp/character-fold-tests.el +++ b/test/lisp/character-fold-tests.el | |||
| @@ -109,16 +109,14 @@ | |||
| 109 | (character-fold-to-regexp string))) | 109 | (character-fold-to-regexp string))) |
| 110 | (with-temp-buffer | 110 | (with-temp-buffer |
| 111 | (save-excursion (insert string)) | 111 | (save-excursion (insert string)) |
| 112 | (let ((time (time-to-seconds (current-time)))) | 112 | (let ((time (float-time))) |
| 113 | ;; Our initial implementation of case-folding in char-folding | 113 | ;; Our initial implementation of case-folding in char-folding |
| 114 | ;; created a lot of redundant paths in the regexp. Because of | 114 | ;; created a lot of redundant paths in the regexp. Because of |
| 115 | ;; that, if a really long string "almost" matches, the regexp | 115 | ;; that, if a really long string "almost" matches, the regexp |
| 116 | ;; engine took a long time to realize that it doesn't match. | 116 | ;; engine took a long time to realize that it doesn't match. |
| 117 | (should-not (character-fold-search-forward (concat string "c") nil 'noerror)) | 117 | (should-not (character-fold-search-forward (concat string "c") nil 'noerror)) |
| 118 | ;; Ensure it took less than a second. | 118 | ;; Ensure it took less than a second. |
| 119 | (should (< (- (time-to-seconds (current-time)) | 119 | (should (< (- (float-time) time) 1)))))) |
| 120 | time) | ||
| 121 | 1)))))) | ||
| 122 | 120 | ||
| 123 | (provide 'character-fold-tests) | 121 | (provide 'character-fold-tests) |
| 124 | ;;; character-fold-tests.el ends here | 122 | ;;; character-fold-tests.el ends here |