diff options
| author | Paul Eggert | 2019-02-10 20:25:22 -0800 |
|---|---|---|
| committer | Paul Eggert | 2019-02-10 23:54:35 -0800 |
| commit | 988e37fa0f922b852715671d59a0e3f682373411 (patch) | |
| tree | 6520da61ebe5a27b3057bfb97eaa83053bf8eeec | |
| parent | 3eb63da19579824801a169a03b9de7bdd945eaa6 (diff) | |
| download | emacs-988e37fa0f922b852715671d59a0e3f682373411.tar.gz emacs-988e37fa0f922b852715671d59a0e3f682373411.zip | |
Simplify use of encode-time
Most uses of (apply #'encode-time foo) can now be replaced
with (encode-time foo). Make similar simplifications.
* lisp/calendar/time-date.el (date-to-time):
* lisp/calendar/timeclock.el (timeclock-when-to-leave)
(timeclock-day-base, timeclock-generate-report):
* lisp/emacs-lisp/timer.el (timer-set-idle-time):
* lisp/eshell/esh-util.el (eshell-parse-ange-ls):
* lisp/gnus/gnus-art.el (article-make-date-line):
* lisp/gnus/gnus-delay.el (gnus-delay-article)
(gnus-delay-send-queue):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--decode-datefield):
* lisp/gnus/gnus-logic.el (gnus-advanced-date):
* lisp/gnus/message.el (message-make-expires-date):
* lisp/gnus/nndiary.el (nndiary-compute-reminders):
* lisp/mail/ietf-drums.el (ietf-drums-parse-date):
* lisp/net/tramp-adb.el (tramp-adb-ls-output-time-less-p):
* lisp/org/org-agenda.el (org-agenda-get-timestamps)
(org-agenda-get-progress, org-agenda-show-clocking-issues):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-get-sum-start, org-clock-sum)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-colview-construct-allowed-dates)
* lisp/org/org-macro.el (org-macro--vc-modified-time):
* lisp/org/org-table.el (org-table-eval-formula):
* lisp/org/org.el (org-current-time, org-store-link)
(org-time-today, org-read-date, org-read-date-display)
(org-display-custom-time, org-time-string-to-time)
(org-timestamp-change, org-timestamp--to-internal-time):
* lisp/url/url-dav.el (url-dav-process-date-property):
* lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time)
(vc-cvs-parse-entry):
Simplify use of encode-time.
* lisp/org/org-clock.el (org-clock-get-clocked-time):
(org-clock-resolve, org-resolve-clocks, org_clock_out)
(org-clock-update-time-maybe):
Avoid some rounding problems with encode-time and float-time.
* lisp/org/org-clock.el (org-clock-in, org-clock-update-time-maybe):
* lisp/org/org-colview.el (org-columns--age-to-minutes):
* lisp/org/org.el (org-get-scheduled-time, org-get-deadline-time)
(org-add-planning-info, org-2ft, org-time-string-to-absolute)
(org-closest-date):
Use org-time-string-to-time instead of doing it by hand with
encode-time.
* lisp/org/org.el (org-current-time): Simplify rounding.
(org-read-date): Avoid extra trip through encode-time.
| -rw-r--r-- | lisp/calendar/time-date.el | 7 | ||||
| -rw-r--r-- | lisp/calendar/timeclock.el | 37 | ||||
| -rw-r--r-- | lisp/emacs-lisp/timer.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/esh-util.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-delay.el | 22 | ||||
| -rw-r--r-- | lisp/gnus/gnus-icalendar.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-logic.el | 6 | ||||
| -rw-r--r-- | lisp/gnus/message.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/nndiary.el | 12 | ||||
| -rw-r--r-- | lisp/mail/ietf-drums.el | 2 | ||||
| -rw-r--r-- | lisp/net/soap-client.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-adb.el | 4 | ||||
| -rw-r--r-- | lisp/org/org-agenda.el | 14 | ||||
| -rw-r--r-- | lisp/org/org-capture.el | 5 | ||||
| -rw-r--r-- | lisp/org/org-clock.el | 58 | ||||
| -rw-r--r-- | lisp/org/org-colview.el | 4 | ||||
| -rw-r--r-- | lisp/org/org-macro.el | 2 | ||||
| -rw-r--r-- | lisp/org/org-table.el | 4 | ||||
| -rw-r--r-- | lisp/org/org.el | 70 | ||||
| -rw-r--r-- | lisp/url/url-dav.el | 2 | ||||
| -rw-r--r-- | lisp/vc/vc-cvs.el | 7 |
22 files changed, 119 insertions, 149 deletions
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index 6fb0f22427a..cc30bd1fda4 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el | |||
| @@ -151,15 +151,14 @@ it is assumed that PICO was omitted and should be treated as zero." | |||
| 151 | DATE should be in one of the forms recognized by `parse-time-string'. | 151 | DATE should be in one of the forms recognized by `parse-time-string'. |
| 152 | If DATE lacks timezone information, GMT is assumed." | 152 | If DATE lacks timezone information, GMT is assumed." |
| 153 | (condition-case err | 153 | (condition-case err |
| 154 | (apply 'encode-time (parse-time-string date)) | 154 | (encode-time (parse-time-string date)) |
| 155 | (error | 155 | (error |
| 156 | (let ((overflow-error '(error "Specified time is not representable"))) | 156 | (let ((overflow-error '(error "Specified time is not representable"))) |
| 157 | (if (equal err overflow-error) | 157 | (if (equal err overflow-error) |
| 158 | (apply 'signal err) | 158 | (apply 'signal err) |
| 159 | (condition-case err | 159 | (condition-case err |
| 160 | (apply 'encode-time | 160 | (encode-time (parse-time-string |
| 161 | (parse-time-string | 161 | (timezone-make-date-arpa-standard date))) |
| 162 | (timezone-make-date-arpa-standard date))) | ||
| 163 | (error | 162 | (error |
| 164 | (if (equal err overflow-error) | 163 | (if (equal err overflow-error) |
| 165 | (apply 'signal err) | 164 | (apply 'signal err) |
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index fd6f5310c8d..5c3580dd848 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el | |||
| @@ -528,14 +528,13 @@ non-nil, the amount returned will be relative to past time worked." | |||
| 528 | "Return a time value representing the end of today's workday. | 528 | "Return a time value representing the end of today's workday. |
| 529 | If TODAY-ONLY is non-nil, the value returned will be relative only to | 529 | If TODAY-ONLY is non-nil, the value returned will be relative only to |
| 530 | the time worked today, and not to past time." | 530 | the time worked today, and not to past time." |
| 531 | (encode-time | 531 | (time-subtract nil |
| 532 | (- (float-time) | 532 | (let ((discrep (timeclock-find-discrep))) |
| 533 | (let ((discrep (timeclock-find-discrep))) | 533 | (if discrep |
| 534 | (if discrep | 534 | (if today-only |
| 535 | (if today-only | 535 | (cadr discrep) |
| 536 | (cadr discrep) | 536 | (car discrep)) |
| 537 | (car discrep)) | 537 | 0)))) |
| 538 | 0.0))))) | ||
| 539 | 538 | ||
| 540 | ;;;###autoload | 539 | ;;;###autoload |
| 541 | (defun timeclock-when-to-leave-string (&optional show-seconds | 540 | (defun timeclock-when-to-leave-string (&optional show-seconds |
| @@ -1156,7 +1155,7 @@ If optional argument TIME is non-nil, use that instead of the current time." | |||
| 1156 | (setcar (nthcdr 0 decoded) 0) | 1155 | (setcar (nthcdr 0 decoded) 0) |
| 1157 | (setcar (nthcdr 1 decoded) 0) | 1156 | (setcar (nthcdr 1 decoded) 0) |
| 1158 | (setcar (nthcdr 2 decoded) 0) | 1157 | (setcar (nthcdr 2 decoded) 0) |
| 1159 | (apply 'encode-time decoded))) | 1158 | (encode-time decoded))) |
| 1160 | 1159 | ||
| 1161 | (defun timeclock-mean (l) | 1160 | (defun timeclock-mean (l) |
| 1162 | "Compute the arithmetic mean of the values in the list L." | 1161 | "Compute the arithmetic mean of the values in the list L." |
| @@ -1196,9 +1195,7 @@ HTML-P is non-nil, HTML markup is added." | |||
| 1196 | (insert project "</b><br>\n") | 1195 | (insert project "</b><br>\n") |
| 1197 | (insert project "*\n")) | 1196 | (insert project "*\n")) |
| 1198 | (let ((proj-data (cdr (assoc project (timeclock-project-alist log)))) | 1197 | (let ((proj-data (cdr (assoc project (timeclock-project-alist log)))) |
| 1199 | (two-weeks-ago (encode-time | 1198 | (two-weeks-ago (time-subtract today (* 2 7 24 60 60))) |
| 1200 | (- (float-time today) | ||
| 1201 | (* 2 7 24 60 60)))) | ||
| 1202 | two-week-len today-len) | 1199 | two-week-len today-len) |
| 1203 | (while proj-data | 1200 | (while proj-data |
| 1204 | (if (not (time-less-p | 1201 | (if (not (time-less-p |
| @@ -1249,18 +1246,10 @@ HTML-P is non-nil, HTML markup is added." | |||
| 1249 | <th>-1 year</th> | 1246 | <th>-1 year</th> |
| 1250 | </tr>") | 1247 | </tr>") |
| 1251 | (let* ((day-list (timeclock-day-list)) | 1248 | (let* ((day-list (timeclock-day-list)) |
| 1252 | (thirty-days-ago (encode-time | 1249 | (thirty-days-ago (time-subtract today (* 30 24 60 60))) |
| 1253 | (- (float-time today) | 1250 | (three-months-ago (time-subtract today (* 90 24 60 60))) |
| 1254 | (* 30 24 60 60)))) | 1251 | (six-months-ago (time-subtract today (* 180 24 60 60))) |
| 1255 | (three-months-ago (encode-time | 1252 | (one-year-ago (time-subtract today (* 365 24 60 60))) |
| 1256 | (- (float-time today) | ||
| 1257 | (* 90 24 60 60)))) | ||
| 1258 | (six-months-ago (encode-time | ||
| 1259 | (- (float-time today) | ||
| 1260 | (* 180 24 60 60)))) | ||
| 1261 | (one-year-ago (encode-time | ||
| 1262 | (- (float-time today) | ||
| 1263 | (* 365 24 60 60)))) | ||
| 1264 | (time-in (vector (list t) (list t) (list t) (list t) (list t))) | 1253 | (time-in (vector (list t) (list t) (list t) (list t) (list t))) |
| 1265 | (time-out (vector (list t) (list t) (list t) (list t) (list t))) | 1254 | (time-out (vector (list t) (list t) (list t) (list t) (list t))) |
| 1266 | (breaks (vector (list t) (list t) (list t) (list t) (list t))) | 1255 | (breaks (vector (list t) (list t) (list t) (list t) (list t))) |
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index f77c9457860..51d7e6f99e2 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el | |||
| @@ -88,7 +88,7 @@ SECS may be an integer, floating point number, or the internal | |||
| 88 | time format returned by, e.g., `current-idle-time'. | 88 | time format returned by, e.g., `current-idle-time'. |
| 89 | If optional third argument REPEAT is non-nil, make the timer | 89 | If optional third argument REPEAT is non-nil, make the timer |
| 90 | fire each time Emacs is idle for that many seconds." | 90 | fire each time Emacs is idle for that many seconds." |
| 91 | (setf (timer--time timer) (if (consp secs) secs (encode-time secs))) | 91 | (setf (timer--time timer) secs) |
| 92 | (setf (timer--repeat-delay timer) repeat) | 92 | (setf (timer--repeat-delay timer) repeat) |
| 93 | timer) | 93 | timer) |
| 94 | 94 | ||
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 7e6e39e74a3..118978e77d0 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el | |||
| @@ -652,7 +652,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. | |||
| 652 | (setcar (nthcdr 0 moment) 0) | 652 | (setcar (nthcdr 0 moment) 0) |
| 653 | (setcar (nthcdr 1 moment) 0) | 653 | (setcar (nthcdr 1 moment) 0) |
| 654 | (setcar (nthcdr 2 moment) 0)) | 654 | (setcar (nthcdr 2 moment) 0)) |
| 655 | (apply 'encode-time moment)) | 655 | (encode-time moment)) |
| 656 | (ange-ftp-file-modtime (expand-file-name name dir)))) | 656 | (ange-ftp-file-modtime (expand-file-name name dir)))) |
| 657 | symlink) | 657 | symlink) |
| 658 | (if (string-match "\\(.+\\) -> \\(.+\\)" name) | 658 | (if (string-match "\\(.+\\) -> \\(.+\\)" name) |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index e39011837a1..191f623afa3 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -3544,7 +3544,7 @@ possible values." | |||
| 3544 | (substring | 3544 | (substring |
| 3545 | (message-make-date | 3545 | (message-make-date |
| 3546 | (let* ((e (parse-time-string date)) | 3546 | (let* ((e (parse-time-string date)) |
| 3547 | (tm (apply 'encode-time e)) | 3547 | (tm (encode-time e)) |
| 3548 | (ms (car tm)) | 3548 | (ms (car tm)) |
| 3549 | (ls (- (cadr tm) (car (current-time-zone time))))) | 3549 | (ls (- (cadr tm) (car (current-time-zone time))))) |
| 3550 | (cond ((< ls 0) (list (1- ms) (+ ls 65536))) | 3550 | (cond ((< ls 0) (list (1- ms) (+ ls 65536))) |
diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el index e013f26adf2..aabf23924a0 100644 --- a/lisp/gnus/gnus-delay.el +++ b/lisp/gnus/gnus-delay.el | |||
| @@ -98,19 +98,15 @@ DELAY is a string, giving the length of the time. Possible values are: | |||
| 98 | (setq hour (string-to-number (match-string 1 delay)) | 98 | (setq hour (string-to-number (match-string 1 delay)) |
| 99 | minute (string-to-number (match-string 2 delay))) | 99 | minute (string-to-number (match-string 2 delay))) |
| 100 | ;; Use current time, except... | 100 | ;; Use current time, except... |
| 101 | (setq deadline (apply 'vector (decode-time))) | 101 | (setq deadline (decode-time)) |
| 102 | ;; ... for minute and hour. | 102 | ;; ... for minute and hour. |
| 103 | (aset deadline 1 minute) | 103 | (setq deadline (apply #'encode-time (car deadline) minute hour |
| 104 | (aset deadline 2 hour) | 104 | (nthcdr 3 deadline))) |
| 105 | ;; Convert to seconds. | ||
| 106 | (setq deadline (float-time (apply 'encode-time | ||
| 107 | (append deadline nil)))) | ||
| 108 | ;; If this time has passed already, add a day. | 105 | ;; If this time has passed already, add a day. |
| 109 | (when (< deadline (float-time)) | 106 | (when (time-less-p deadline nil) |
| 110 | (setq deadline (+ 86400 deadline))) ; 86400 secs/day | 107 | (setq deadline (time-add 86400 deadline))) ; 86400 secs/day |
| 111 | ;; Convert seconds to date header. | 108 | ;; Convert seconds to date header. |
| 112 | (setq deadline (message-make-date | 109 | (setq deadline (message-make-date deadline))) |
| 113 | (encode-time deadline)))) | ||
| 114 | ((string-match "\\([0-9]+\\)\\s-*\\([mhdwMY]\\)" delay) | 110 | ((string-match "\\([0-9]+\\)\\s-*\\([mhdwMY]\\)" delay) |
| 115 | (setq num (match-string 1 delay)) | 111 | (setq num (match-string 1 delay)) |
| 116 | (setq unit (match-string 2 delay)) | 112 | (setq unit (match-string 2 delay)) |
| @@ -128,8 +124,7 @@ DELAY is a string, giving the length of the time. Possible values are: | |||
| 128 | (setq delay (* num 60 60))) | 124 | (setq delay (* num 60 60))) |
| 129 | (t | 125 | (t |
| 130 | (setq delay (* num 60)))) | 126 | (setq delay (* num 60)))) |
| 131 | (setq deadline (message-make-date | 127 | (setq deadline (message-make-date (time-add nil delay)))) |
| 132 | (encode-time (+ (float-time) delay))))) | ||
| 133 | (t (error "Malformed delay `%s'" delay))) | 128 | (t (error "Malformed delay `%s'" delay))) |
| 134 | (message-add-header (format "%s: %s" gnus-delay-header deadline))) | 129 | (message-add-header (format "%s: %s" gnus-delay-header deadline))) |
| 135 | (set-buffer-modified-p t) | 130 | (set-buffer-modified-p t) |
| @@ -164,8 +159,7 @@ DELAY is a string, giving the length of the time. Possible values are: | |||
| 164 | nil t) | 159 | nil t) |
| 165 | (progn | 160 | (progn |
| 166 | (setq deadline (nnheader-header-value)) | 161 | (setq deadline (nnheader-header-value)) |
| 167 | (setq deadline (apply 'encode-time | 162 | (setq deadline (encode-time (parse-time-string deadline))) |
| 168 | (parse-time-string deadline))) | ||
| 169 | (unless (time-less-p nil deadline) | 163 | (unless (time-less-p nil deadline) |
| 170 | (message "Sending delayed article %d" article) | 164 | (message "Sending delayed article %d" article) |
| 171 | (gnus-draft-send article group) | 165 | (gnus-draft-send article group) |
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index e39561edb33..06f09271647 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el | |||
| @@ -147,7 +147,7 @@ | |||
| 147 | (icalendar--get-event-property-attributes | 147 | (icalendar--get-event-property-attributes |
| 148 | event field) zone-map)) | 148 | event field) zone-map)) |
| 149 | (dtdate-dec (icalendar--decode-isodatetime dtdate nil dtdate-zone))) | 149 | (dtdate-dec (icalendar--decode-isodatetime dtdate nil dtdate-zone))) |
| 150 | (apply 'encode-time dtdate-dec))) | 150 | (encode-time dtdate-dec))) |
| 151 | 151 | ||
| 152 | (defun gnus-icalendar-event--find-attendee (ical name-or-email) | 152 | (defun gnus-icalendar-event--find-attendee (ical name-or-email) |
| 153 | (let* ((event (car (icalendar--all-events ical))) | 153 | (let* ((event (car (icalendar--all-events ical))) |
diff --git a/lisp/gnus/gnus-logic.el b/lisp/gnus/gnus-logic.el index 8bf15cfd5b3..90f74205209 100644 --- a/lisp/gnus/gnus-logic.el +++ b/lisp/gnus/gnus-logic.el | |||
| @@ -162,9 +162,9 @@ | |||
| 162 | (funcall type (or (aref gnus-advanced-headers index) 0) match))) | 162 | (funcall type (or (aref gnus-advanced-headers index) 0) match))) |
| 163 | 163 | ||
| 164 | (defun gnus-advanced-date (index match type) | 164 | (defun gnus-advanced-date (index match type) |
| 165 | (let ((date (apply 'encode-time (parse-time-string | 165 | (let ((date (encode-time (parse-time-string |
| 166 | (aref gnus-advanced-headers index)))) | 166 | (aref gnus-advanced-headers index)))) |
| 167 | (match (apply 'encode-time (parse-time-string match)))) | 167 | (match (encode-time (parse-time-string match)))) |
| 168 | (cond | 168 | (cond |
| 169 | ((eq type 'at) | 169 | ((eq type 'at) |
| 170 | (equal date match)) | 170 | (equal date match)) |
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 9d5445c18cc..b0674525a86 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -5542,7 +5542,7 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'." | |||
| 5542 | (let* ((cur (decode-time)) | 5542 | (let* ((cur (decode-time)) |
| 5543 | (nday (+ days (nth 3 cur)))) | 5543 | (nday (+ days (nth 3 cur)))) |
| 5544 | (setf (nth 3 cur) nday) | 5544 | (setf (nth 3 cur) nday) |
| 5545 | (message-make-date (apply 'encode-time cur)))) | 5545 | (message-make-date (encode-time cur)))) |
| 5546 | 5546 | ||
| 5547 | (defun message-make-message-id () | 5547 | (defun message-make-message-id () |
| 5548 | "Make a unique Message-ID." | 5548 | "Make a unique Message-ID." |
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el index 3798be10582..c8b7eed9870 100644 --- a/lisp/gnus/nndiary.el +++ b/lisp/gnus/nndiary.el | |||
| @@ -1278,27 +1278,27 @@ all. This may very well take some time.") | |||
| 1278 | (push | 1278 | (push |
| 1279 | (cond ((eq (cdr reminder) 'minute) | 1279 | (cond ((eq (cdr reminder) 'minute) |
| 1280 | (time-subtract | 1280 | (time-subtract |
| 1281 | (apply 'encode-time 0 (nthcdr 1 date-elts)) | 1281 | (apply #'encode-time 0 (nthcdr 1 date-elts)) |
| 1282 | (encode-time (* (car reminder) 60.0)))) | 1282 | (encode-time (* (car reminder) 60.0)))) |
| 1283 | ((eq (cdr reminder) 'hour) | 1283 | ((eq (cdr reminder) 'hour) |
| 1284 | (time-subtract | 1284 | (time-subtract |
| 1285 | (apply 'encode-time 0 0 (nthcdr 2 date-elts)) | 1285 | (apply #'encode-time 0 0 (nthcdr 2 date-elts)) |
| 1286 | (encode-time (* (car reminder) 3600.0)))) | 1286 | (encode-time (* (car reminder) 3600.0)))) |
| 1287 | ((eq (cdr reminder) 'day) | 1287 | ((eq (cdr reminder) 'day) |
| 1288 | (time-subtract | 1288 | (time-subtract |
| 1289 | (apply 'encode-time 0 0 0 (nthcdr 3 date-elts)) | 1289 | (apply #'encode-time 0 0 0 (nthcdr 3 date-elts)) |
| 1290 | (encode-time (* (car reminder) 86400.0)))) | 1290 | (encode-time (* (car reminder) 86400.0)))) |
| 1291 | ((eq (cdr reminder) 'week) | 1291 | ((eq (cdr reminder) 'week) |
| 1292 | (time-subtract | 1292 | (time-subtract |
| 1293 | (apply 'encode-time 0 0 0 monday (nthcdr 4 date-elts)) | 1293 | (apply #'encode-time 0 0 0 monday (nthcdr 4 date-elts)) |
| 1294 | (encode-time (* (car reminder) 604800.0)))) | 1294 | (encode-time (* (car reminder) 604800.0)))) |
| 1295 | ((eq (cdr reminder) 'month) | 1295 | ((eq (cdr reminder) 'month) |
| 1296 | (time-subtract | 1296 | (time-subtract |
| 1297 | (apply 'encode-time 0 0 0 1 (nthcdr 4 date-elts)) | 1297 | (apply #'encode-time 0 0 0 1 (nthcdr 4 date-elts)) |
| 1298 | (encode-time (* (car reminder) 18748800.0)))) | 1298 | (encode-time (* (car reminder) 18748800.0)))) |
| 1299 | ((eq (cdr reminder) 'year) | 1299 | ((eq (cdr reminder) 'year) |
| 1300 | (time-subtract | 1300 | (time-subtract |
| 1301 | (apply 'encode-time 0 0 0 1 1 (nthcdr 5 date-elts)) | 1301 | (apply #'encode-time 0 0 0 1 1 (nthcdr 5 date-elts)) |
| 1302 | (encode-time (* (car reminder) 400861056.0))))) | 1302 | (encode-time (* (car reminder) 400861056.0))))) |
| 1303 | res)) | 1303 | res)) |
| 1304 | (sort res 'time-less-p))) | 1304 | (sort res 'time-less-p))) |
diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el index 66006573c14..81377c9c41a 100644 --- a/lisp/mail/ietf-drums.el +++ b/lisp/mail/ietf-drums.el | |||
| @@ -294,7 +294,7 @@ a list of address strings." | |||
| 294 | 294 | ||
| 295 | (defun ietf-drums-parse-date (string) | 295 | (defun ietf-drums-parse-date (string) |
| 296 | "Return an Emacs time spec from STRING." | 296 | "Return an Emacs time spec from STRING." |
| 297 | (apply 'encode-time (parse-time-string string))) | 297 | (encode-time (parse-time-string string))) |
| 298 | 298 | ||
| 299 | (defun ietf-drums-narrow-to-header () | 299 | (defun ietf-drums-narrow-to-header () |
| 300 | "Narrow to the header section in the current buffer." | 300 | "Narrow to the header section in the current buffer." |
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index db8ed16ee0f..1632ee13758 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el | |||
| @@ -629,7 +629,7 @@ disallows them." | |||
| 629 | (<= time-zone-minute 59)) | 629 | (<= time-zone-minute 59)) |
| 630 | (error "Invalid or unsupported time: %s" date-time-string)) | 630 | (error "Invalid or unsupported time: %s" date-time-string)) |
| 631 | ;; Return a value in a format similar to that returned by decode-time, and | 631 | ;; Return a value in a format similar to that returned by decode-time, and |
| 632 | ;; suitable for (apply 'encode-time ...). | 632 | ;; suitable for (apply #'encode-time ...). |
| 633 | (list second minute hour day month year second-fraction datatype | 633 | (list second minute hour day month year second-fraction datatype |
| 634 | (if has-time-zone | 634 | (if has-time-zone |
| 635 | (* (rng-xsd-time-to-seconds | 635 | (* (rng-xsd-time-to-seconds |
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index b9b1e4aab6c..34faf4ce280 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -488,9 +488,9 @@ Emacs dired can't find files." | |||
| 488 | "Sort \"ls\" output by time, descending." | 488 | "Sort \"ls\" output by time, descending." |
| 489 | (let (time-a time-b) | 489 | (let (time-a time-b) |
| 490 | (string-match tramp-adb-ls-date-regexp a) | 490 | (string-match tramp-adb-ls-date-regexp a) |
| 491 | (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a)))) | 491 | (setq time-a (apply #'encode-time (parse-time-string (match-string 0 a)))) |
| 492 | (string-match tramp-adb-ls-date-regexp b) | 492 | (string-match tramp-adb-ls-date-regexp b) |
| 493 | (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b)))) | 493 | (setq time-b (apply #'encode-time (parse-time-string (match-string 0 b)))) |
| 494 | (time-less-p time-b time-a))) | 494 | (time-less-p time-b time-a))) |
| 495 | 495 | ||
| 496 | (defun tramp-adb-ls-output-name-less-p (a b) | 496 | (defun tramp-adb-ls-output-name-less-p (a b) |
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 6cc5214306a..d491dff4779 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el | |||
| @@ -5491,8 +5491,8 @@ displayed in agenda view." | |||
| 5491 | (substring | 5491 | (substring |
| 5492 | (format-time-string | 5492 | (format-time-string |
| 5493 | (car org-time-stamp-formats) | 5493 | (car org-time-stamp-formats) |
| 5494 | (apply #'encode-time ; DATE bound by calendar | 5494 | (encode-time ; DATE bound by calendar |
| 5495 | (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) | 5495 | 0 0 0 (nth 1 date) (car date) (nth 2 date))) |
| 5496 | 1 11)) | 5496 | 1 11)) |
| 5497 | "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)" | 5497 | "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)" |
| 5498 | "\\|\\(<%%\\(([^>\n]+)\\)>\\)")) | 5498 | "\\|\\(<%%\\(([^>\n]+)\\)>\\)")) |
| @@ -5742,8 +5742,8 @@ then those holidays will be skipped." | |||
| 5742 | (substring | 5742 | (substring |
| 5743 | (format-time-string | 5743 | (format-time-string |
| 5744 | (car org-time-stamp-formats) | 5744 | (car org-time-stamp-formats) |
| 5745 | (apply 'encode-time ; DATE bound by calendar | 5745 | (encode-time ; DATE bound by calendar |
| 5746 | (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) | 5746 | 0 0 0 (nth 1 date) (car date) (nth 2 date))) |
| 5747 | 1 11)))) | 5747 | 1 11)))) |
| 5748 | (org-agenda-search-headline-for-time nil) | 5748 | (org-agenda-search-headline-for-time nil) |
| 5749 | marker hdmarker priority category level tags closedp | 5749 | marker hdmarker priority category level tags closedp |
| @@ -5860,10 +5860,8 @@ See also the user option `org-agenda-clock-consistency-checks'." | |||
| 5860 | (throw 'next t)) | 5860 | (throw 'next t)) |
| 5861 | (setq ts (match-string 1) | 5861 | (setq ts (match-string 1) |
| 5862 | te (match-string 3) | 5862 | te (match-string 3) |
| 5863 | ts (float-time | 5863 | ts (float-time (org-time-string-to-time ts)) |
| 5864 | (apply #'encode-time (org-parse-time-string ts))) | 5864 | te (float-time (org-time-string-to-time te)) |
| 5865 | te (float-time | ||
| 5866 | (apply #'encode-time (org-parse-time-string te))) | ||
| 5867 | dt (- te ts)))) | 5865 | dt (- te ts)))) |
| 5868 | (cond | 5866 | (cond |
| 5869 | ((> dt (* 60 maxtime)) | 5867 | ((> dt (* 60 maxtime)) |
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index a699d2e28fc..0c7f159369f 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el | |||
| @@ -1009,9 +1009,8 @@ Store them in the capture property list." | |||
| 1009 | (not (= (time-to-days prompt-time) (org-today)))) | 1009 | (not (= (time-to-days prompt-time) (org-today)))) |
| 1010 | ;; Use 00:00 when no time is given for another | 1010 | ;; Use 00:00 when no time is given for another |
| 1011 | ;; date than today? | 1011 | ;; date than today? |
| 1012 | (apply #'encode-time | 1012 | (apply #'encode-time 0 0 0 |
| 1013 | (append '(0 0 0) | 1013 | (cl-cdddr (decode-time prompt-time)))) |
| 1014 | (cl-cdddr (decode-time prompt-time))))) | ||
| 1015 | ((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)" | 1014 | ((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)" |
| 1016 | org-read-date-final-answer) | 1015 | org-read-date-final-answer) |
| 1017 | ;; Replace any time range by its start. | 1016 | ;; Replace any time range by its start. |
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index b177450d33f..babf1f70669 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el | |||
| @@ -723,8 +723,8 @@ menu\nmouse-2 will jump to task")) | |||
| 723 | The time returned includes the time spent on this task in | 723 | The time returned includes the time spent on this task in |
| 724 | previous clocking intervals." | 724 | previous clocking intervals." |
| 725 | (let ((currently-clocked-time | 725 | (let ((currently-clocked-time |
| 726 | (floor (- (float-time) | 726 | (floor (encode-time (time-subtract nil org-clock-start-time) 'integer) |
| 727 | (float-time org-clock-start-time)) 60))) | 727 | 60))) |
| 728 | (+ currently-clocked-time (or org-clock-total-time 0)))) | 728 | (+ currently-clocked-time (or org-clock-total-time 0)))) |
| 729 | 729 | ||
| 730 | (defun org-clock-modify-effort-estimate (&optional value) | 730 | (defun org-clock-modify-effort-estimate (&optional value) |
| @@ -1033,8 +1033,9 @@ to be CLOCKED OUT.")))) | |||
| 1033 | nil 45))) | 1033 | nil 45))) |
| 1034 | (and (not (memq char-pressed '(?i ?q))) char-pressed))))) | 1034 | (and (not (memq char-pressed '(?i ?q))) char-pressed))))) |
| 1035 | (default | 1035 | (default |
| 1036 | (floor (/ (float-time | 1036 | (floor (encode-time (time-subtract (current-time) last-valid) |
| 1037 | (time-subtract (current-time) last-valid)) 60))) | 1037 | 'integer) |
| 1038 | 60)) | ||
| 1038 | (keep | 1039 | (keep |
| 1039 | (and (memq ch '(?k ?K)) | 1040 | (and (memq ch '(?k ?K)) |
| 1040 | (read-number "Keep how many minutes? " default))) | 1041 | (read-number "Keep how many minutes? " default))) |
| @@ -1102,8 +1103,8 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling | |||
| 1102 | (lambda (clock) | 1103 | (lambda (clock) |
| 1103 | (format | 1104 | (format |
| 1104 | "Dangling clock started %d mins ago" | 1105 | "Dangling clock started %d mins ago" |
| 1105 | (floor (- (float-time) | 1106 | (floor (encode-time (time-subtract nil (cdr clock)) |
| 1106 | (float-time (cdr clock))) | 1107 | 'integer) |
| 1107 | 60))))) | 1108 | 60))))) |
| 1108 | (or last-valid | 1109 | (or last-valid |
| 1109 | (cdr clock))))))))))) | 1110 | (cdr clock))))))))))) |
| @@ -1293,8 +1294,7 @@ the default behavior." | |||
| 1293 | (setq ts (concat "[" (match-string 1) "]")) | 1294 | (setq ts (concat "[" (match-string 1) "]")) |
| 1294 | (goto-char (match-end 1)) | 1295 | (goto-char (match-end 1)) |
| 1295 | (setq org-clock-start-time | 1296 | (setq org-clock-start-time |
| 1296 | (apply 'encode-time | 1297 | (org-time-string-to-time (match-string 1))) |
| 1297 | (org-parse-time-string (match-string 1)))) | ||
| 1298 | (setq org-clock-effort (org-entry-get (point) org-effort-property)) | 1298 | (setq org-clock-effort (org-entry-get (point) org-effort-property)) |
| 1299 | (setq org-clock-total-time (org-clock-sum-current-item | 1299 | (setq org-clock-total-time (org-clock-sum-current-item |
| 1300 | (org-clock-get-sum-start)))) | 1300 | (org-clock-get-sum-start)))) |
| @@ -1431,7 +1431,7 @@ The time is always returned as UTC." | |||
| 1431 | (day (nth 3 dt))) | 1431 | (day (nth 3 dt))) |
| 1432 | (if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day))) | 1432 | (if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day))) |
| 1433 | (setf (nth 2 dt) org-extend-today-until) | 1433 | (setf (nth 2 dt) org-extend-today-until) |
| 1434 | (apply #'encode-time (append (list 0 0) (nthcdr 2 dt))))) | 1434 | (apply #'encode-time 0 0 (nthcdr 2 dt)))) |
| 1435 | ((or (equal cmt "all") | 1435 | ((or (equal cmt "all") |
| 1436 | (and (or (not cmt) (equal cmt "auto")) | 1436 | (and (or (not cmt) (equal cmt "auto")) |
| 1437 | (not lr))) | 1437 | (not lr))) |
| @@ -1577,14 +1577,12 @@ to, overriding the existing value of `org-clock-out-switch-to-state'." | |||
| 1577 | (delete-region (point) (point-at-eol)) | 1577 | (delete-region (point) (point-at-eol)) |
| 1578 | (insert "--") | 1578 | (insert "--") |
| 1579 | (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive)) | 1579 | (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive)) |
| 1580 | (setq s (- (float-time | 1580 | (setq s (float-time (time-subtract |
| 1581 | (apply #'encode-time (org-parse-time-string te))) | 1581 | (org-time-string-to-time te) |
| 1582 | (float-time | 1582 | (org-time-string-to-time ts))) |
| 1583 | (apply #'encode-time (org-parse-time-string ts)))) | 1583 | h (floor s 3600) |
| 1584 | h (floor (/ s 3600)) | ||
| 1585 | s (- s (* 3600 h)) | 1584 | s (- s (* 3600 h)) |
| 1586 | m (floor (/ s 60)) | 1585 | m (floor s 60)) |
| 1587 | s (- s (* 60 s))) | ||
| 1588 | (insert " => " (format "%2d:%02d" h m)) | 1586 | (insert " => " (format "%2d:%02d" h m)) |
| 1589 | (move-marker org-clock-marker nil) | 1587 | (move-marker org-clock-marker nil) |
| 1590 | (move-marker org-clock-hd-marker nil) | 1588 | (move-marker org-clock-hd-marker nil) |
| @@ -1813,15 +1811,15 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes." | |||
| 1813 | ((match-end 2) | 1811 | ((match-end 2) |
| 1814 | ;; Two time stamps. | 1812 | ;; Two time stamps. |
| 1815 | (let* ((ts (float-time | 1813 | (let* ((ts (float-time |
| 1816 | (apply #'encode-time | 1814 | (encode-time |
| 1817 | (save-match-data | 1815 | (save-match-data |
| 1818 | (org-parse-time-string (match-string 2)))))) | 1816 | (org-parse-time-string (match-string 2)))))) |
| 1819 | (te (float-time | 1817 | (te (float-time |
| 1820 | (apply #'encode-time | 1818 | (encode-time |
| 1821 | (org-parse-time-string (match-string 3))))) | 1819 | (org-parse-time-string (match-string 3))))) |
| 1822 | (dt (- (if tend (min te tend) te) | 1820 | (dt (- (if tend (min te tend) te) |
| 1823 | (if tstart (max ts tstart) ts)))) | 1821 | (if tstart (max ts tstart) ts)))) |
| 1824 | (when (> dt 0) (cl-incf t1 (floor (/ dt 60)))))) | 1822 | (when (> dt 0) (cl-incf t1 (floor dt 60))))) |
| 1825 | ((match-end 4) | 1823 | ((match-end 4) |
| 1826 | ;; A naked time. | 1824 | ;; A naked time. |
| 1827 | (setq t1 (+ t1 (string-to-number (match-string 5)) | 1825 | (setq t1 (+ t1 (string-to-number (match-string 5)) |
| @@ -2704,14 +2702,14 @@ LEVEL is an integer. Indent by two spaces per level above 1." | |||
| 2704 | (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute ts))) | 2702 | (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute ts))) |
| 2705 | (setq ts (float-time (encode-time 0 0 0 day month year))))) | 2703 | (setq ts (float-time (encode-time 0 0 0 day month year))))) |
| 2706 | (ts | 2704 | (ts |
| 2707 | (setq ts (float-time (apply #'encode-time (org-parse-time-string ts)))))) | 2705 | (setq ts (float-time (org-time-string-to-time ts))))) |
| 2708 | (cond | 2706 | (cond |
| 2709 | ((numberp te) | 2707 | ((numberp te) |
| 2710 | ;; Likewise for te. | 2708 | ;; Likewise for te. |
| 2711 | (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute te))) | 2709 | (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute te))) |
| 2712 | (setq te (float-time (encode-time 0 0 0 day month year))))) | 2710 | (setq te (float-time (encode-time 0 0 0 day month year))))) |
| 2713 | (te | 2711 | (te |
| 2714 | (setq te (float-time (apply #'encode-time (org-parse-time-string te)))))) | 2712 | (setq te (float-time (org-time-string-to-time te))))) |
| 2715 | (setq tsb | 2713 | (setq tsb |
| 2716 | (if (eq step0 'week) | 2714 | (if (eq step0 'week) |
| 2717 | (let ((dow (nth 6 (decode-time (encode-time ts))))) | 2715 | (let ((dow (nth 6 (decode-time (encode-time ts))))) |
| @@ -2720,7 +2718,7 @@ LEVEL is an integer. Indent by two spaces per level above 1." | |||
| 2720 | ts)) | 2718 | ts)) |
| 2721 | (while (< tsb te) | 2719 | (while (< tsb te) |
| 2722 | (unless (bolp) (insert "\n")) | 2720 | (unless (bolp) (insert "\n")) |
| 2723 | (let ((start-time (encode-time (max tsb ts)))) | 2721 | (let ((start-time (max tsb ts))) |
| 2724 | (cl-incf tsb (let ((dow (nth 6 (decode-time (encode-time tsb))))) | 2722 | (cl-incf tsb (let ((dow (nth 6 (decode-time (encode-time tsb))))) |
| 2725 | (if (or (eq step0 'day) | 2723 | (if (or (eq step0 'day) |
| 2726 | (= dow ws)) | 2724 | (= dow ws)) |
| @@ -2882,18 +2880,16 @@ Otherwise, return nil." | |||
| 2882 | (<= org-clock-marker (point-at-eol))) | 2880 | (<= org-clock-marker (point-at-eol))) |
| 2883 | ;; The clock is running here | 2881 | ;; The clock is running here |
| 2884 | (setq org-clock-start-time | 2882 | (setq org-clock-start-time |
| 2885 | (apply 'encode-time | 2883 | (org-time-string-to-time (match-string 1))) |
| 2886 | (org-parse-time-string (match-string 1)))) | ||
| 2887 | (org-clock-update-mode-line))) | 2884 | (org-clock-update-mode-line))) |
| 2888 | (t | 2885 | (t |
| 2889 | (and (match-end 4) (delete-region (match-beginning 4) (match-end 4))) | 2886 | (and (match-end 4) (delete-region (match-beginning 4) (match-end 4))) |
| 2890 | (end-of-line 1) | 2887 | (end-of-line 1) |
| 2891 | (setq ts (match-string 1) | 2888 | (setq ts (match-string 1) |
| 2892 | te (match-string 3)) | 2889 | te (match-string 3)) |
| 2893 | (setq s (- (float-time | 2890 | (setq s (float-time |
| 2894 | (apply #'encode-time (org-parse-time-string te))) | 2891 | (time-subtract (org-time-string-to-time te) |
| 2895 | (float-time | 2892 | (org-time-string-to-time ts))) |
| 2896 | (apply #'encode-time (org-parse-time-string ts)))) | ||
| 2897 | neg (< s 0) | 2893 | neg (< s 0) |
| 2898 | s (abs s) | 2894 | s (abs s) |
| 2899 | h (floor (/ s 3600)) | 2895 | h (floor (/ s 3600)) |
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 2c34eddcf6b..f3e118b6dea 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el | |||
| @@ -719,7 +719,7 @@ around it." | |||
| 719 | (setq time-after (copy-sequence time)) | 719 | (setq time-after (copy-sequence time)) |
| 720 | (setf (nth 3 time-before) (1- (nth 3 time))) | 720 | (setf (nth 3 time-before) (1- (nth 3 time))) |
| 721 | (setf (nth 3 time-after) (1+ (nth 3 time))) | 721 | (setf (nth 3 time-after) (1+ (nth 3 time))) |
| 722 | (mapcar (lambda (x) (format-time-string fmt (apply 'encode-time x))) | 722 | (mapcar (lambda (x) (format-time-string fmt (encode-time x))) |
| 723 | (list time-before time time-after))))) | 723 | (list time-before time time-after))))) |
| 724 | 724 | ||
| 725 | (defun org-columns-open-link (&optional arg) | 725 | (defun org-columns-open-link (&optional arg) |
| @@ -1070,7 +1070,7 @@ as a canonical duration, i.e., using units defined in | |||
| 1070 | (cond | 1070 | (cond |
| 1071 | ((string-match-p org-ts-regexp s) | 1071 | ((string-match-p org-ts-regexp s) |
| 1072 | (/ (- org-columns--time | 1072 | (/ (- org-columns--time |
| 1073 | (float-time (apply #'encode-time (org-parse-time-string s)))) | 1073 | (float-time (org-time-string-to-time s))) |
| 1074 | 60)) | 1074 | 60)) |
| 1075 | ((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units | 1075 | ((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units |
| 1076 | (t (user-error "Invalid age: %S" s)))) | 1076 | (t (user-error "Invalid age: %S" s)))) |
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el index 7d04d02970c..a151e1e8469 100644 --- a/lisp/org/org-macro.el +++ b/lisp/org/org-macro.el | |||
| @@ -313,7 +313,7 @@ Return a list of arguments, as strings. This is the opposite of | |||
| 313 | (buffer-substring | 313 | (buffer-substring |
| 314 | (point) (line-end-position))))) | 314 | (point) (line-end-position))))) |
| 315 | (when (cl-some #'identity time) | 315 | (when (cl-some #'identity time) |
| 316 | (setq date (apply #'encode-time time)))))))) | 316 | (setq date (encode-time time)))))))) |
| 317 | (let ((proc (get-buffer-process buf))) | 317 | (let ((proc (get-buffer-process buf))) |
| 318 | (while (and proc (accept-process-output proc .5 nil t))))) | 318 | (while (and proc (accept-process-output proc .5 nil t))))) |
| 319 | (kill-buffer buf)) | 319 | (kill-buffer buf)) |
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 0a8382c8b56..81a77fde6c7 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el | |||
| @@ -2909,8 +2909,8 @@ location of point." | |||
| 2909 | (format-time-string | 2909 | (format-time-string |
| 2910 | (org-time-stamp-format | 2910 | (org-time-stamp-format |
| 2911 | (string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts)) | 2911 | (string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts)) |
| 2912 | (apply #'encode-time | 2912 | (encode-time |
| 2913 | (save-match-data (org-parse-time-string ts)))))) | 2913 | (save-match-data (org-parse-time-string ts)))))) |
| 2914 | form t t)) | 2914 | form t t)) |
| 2915 | 2915 | ||
| 2916 | (setq ev (if (and duration (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form)) | 2916 | (setq ev (if (and duration (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form)) |
diff --git a/lisp/org/org.el b/lisp/org/org.el index 91a4799a21a..b627282a63d 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el | |||
| @@ -5613,16 +5613,15 @@ When ROUNDING-MINUTES is not an integer, fall back on the car of | |||
| 5613 | the rounding returns a past time." | 5613 | the rounding returns a past time." |
| 5614 | (let ((r (or (and (integerp rounding-minutes) rounding-minutes) | 5614 | (let ((r (or (and (integerp rounding-minutes) rounding-minutes) |
| 5615 | (car org-time-stamp-rounding-minutes))) | 5615 | (car org-time-stamp-rounding-minutes))) |
| 5616 | (time (decode-time)) res) | 5616 | (now (current-time))) |
| 5617 | (if (< r 1) | 5617 | (if (< r 1) |
| 5618 | (current-time) | 5618 | now |
| 5619 | (setq res | 5619 | (let* ((time (decode-time now)) |
| 5620 | (apply 'encode-time | 5620 | (res (apply #'encode-time 0 (* r (round (nth 1 time) r)) |
| 5621 | (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r))))) | 5621 | (nthcdr 2 time)))) |
| 5622 | (nthcdr 2 time)))) | 5622 | (if (or (not past) (time-less-p res now)) |
| 5623 | (if (and past (< (float-time (time-subtract (current-time) res)) 0)) | 5623 | res |
| 5624 | (encode-time (- (float-time res) (* r 60))) | 5624 | (time-subtract res (* r 60))))))) |
| 5625 | res)))) | ||
| 5626 | 5625 | ||
| 5627 | (defun org-today () | 5626 | (defun org-today () |
| 5628 | "Return today date, considering `org-extend-today-until'." | 5627 | "Return today date, considering `org-extend-today-until'." |
| @@ -9743,9 +9742,7 @@ active region." | |||
| 9743 | (setq link | 9742 | (setq link |
| 9744 | (format-time-string | 9743 | (format-time-string |
| 9745 | (car org-time-stamp-formats) | 9744 | (car org-time-stamp-formats) |
| 9746 | (apply 'encode-time | 9745 | (encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)))) |
| 9747 | (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd) | ||
| 9748 | nil nil nil)))) | ||
| 9749 | (org-store-link-props :type "calendar" :date cd))) | 9746 | (org-store-link-props :type "calendar" :date cd))) |
| 9750 | 9747 | ||
| 9751 | ((eq major-mode 'help-mode) | 9748 | ((eq major-mode 'help-mode) |
| @@ -13344,7 +13341,7 @@ for calling org-schedule with, or if there is no scheduling, | |||
| 13344 | returns nil." | 13341 | returns nil." |
| 13345 | (let ((time (org-entry-get pom "SCHEDULED" inherit))) | 13342 | (let ((time (org-entry-get pom "SCHEDULED" inherit))) |
| 13346 | (when time | 13343 | (when time |
| 13347 | (apply 'encode-time (org-parse-time-string time))))) | 13344 | (org-time-string-to-time time)))) |
| 13348 | 13345 | ||
| 13349 | (defun org-get-deadline-time (pom &optional inherit) | 13346 | (defun org-get-deadline-time (pom &optional inherit) |
| 13350 | "Get the deadline as a time tuple, of a format suitable for | 13347 | "Get the deadline as a time tuple, of a format suitable for |
| @@ -13352,7 +13349,7 @@ calling org-deadline with, or if there is no scheduling, returns | |||
| 13352 | nil." | 13349 | nil." |
| 13353 | (let ((time (org-entry-get pom "DEADLINE" inherit))) | 13350 | (let ((time (org-entry-get pom "DEADLINE" inherit))) |
| 13354 | (when time | 13351 | (when time |
| 13355 | (apply 'encode-time (org-parse-time-string time))))) | 13352 | (org-time-string-to-time time)))) |
| 13356 | 13353 | ||
| 13357 | (defun org-remove-timestamp-with-keyword (keyword) | 13354 | (defun org-remove-timestamp-with-keyword (keyword) |
| 13358 | "Remove all time stamps with KEYWORD in the current entry." | 13355 | "Remove all time stamps with KEYWORD in the current entry." |
| @@ -13411,7 +13408,7 @@ WHAT entry will also be removed." | |||
| 13411 | org-deadline-time-regexp) | 13408 | org-deadline-time-regexp) |
| 13412 | end t) | 13409 | end t) |
| 13413 | (setq ts (match-string 1) | 13410 | (setq ts (match-string 1) |
| 13414 | default-time (apply 'encode-time (org-parse-time-string ts)) | 13411 | default-time (org-time-string-to-time ts) |
| 13415 | default-input (and ts (org-get-compact-tod ts))))))) | 13412 | default-input (and ts (org-get-compact-tod ts))))))) |
| 13416 | (when what | 13413 | (when what |
| 13417 | (setq time | 13414 | (setq time |
| @@ -14668,7 +14665,7 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0." | |||
| 14668 | ((numberp s) s) | 14665 | ((numberp s) s) |
| 14669 | ((stringp s) | 14666 | ((stringp s) |
| 14670 | (condition-case nil | 14667 | (condition-case nil |
| 14671 | (float-time (apply #'encode-time (org-parse-time-string s))) | 14668 | (float-time (org-time-string-to-time s)) |
| 14672 | (error 0.))) | 14669 | (error 0.))) |
| 14673 | (t 0.))) | 14670 | (t 0.))) |
| 14674 | 14671 | ||
| @@ -14676,8 +14673,7 @@ it as a time string and apply `float-time' to it. If S is nil, just return 0." | |||
| 14676 | "Time in seconds today at 0:00. | 14673 | "Time in seconds today at 0:00. |
| 14677 | Returns the float number of seconds since the beginning of the | 14674 | Returns the float number of seconds since the beginning of the |
| 14678 | epoch to the beginning of today (00:00)." | 14675 | epoch to the beginning of today (00:00)." |
| 14679 | (float-time (apply 'encode-time | 14676 | (float-time (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time))))) |
| 14680 | (append '(0 0 0) (nthcdr 3 (decode-time)))))) | ||
| 14681 | 14677 | ||
| 14682 | (defun org-matcher-time (s) | 14678 | (defun org-matcher-time (s) |
| 14683 | "Interpret a time comparison value." | 14679 | "Interpret a time comparison value." |
| @@ -16573,7 +16569,7 @@ non-nil." | |||
| 16573 | ;; Default time is either the timestamp at point or today. | 16569 | ;; Default time is either the timestamp at point or today. |
| 16574 | ;; When entering a range, only the range start is considered. | 16570 | ;; When entering a range, only the range start is considered. |
| 16575 | (default-time (if (not ts) (current-time) | 16571 | (default-time (if (not ts) (current-time) |
| 16576 | (apply #'encode-time (org-parse-time-string ts)))) | 16572 | (org-time-string-to-time ts))) |
| 16577 | (default-input (and ts (org-get-compact-tod ts))) | 16573 | (default-input (and ts (org-get-compact-tod ts))) |
| 16578 | (repeater (and ts | 16574 | (repeater (and ts |
| 16579 | (string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts) | 16575 | (string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts) |
| @@ -16820,7 +16816,7 @@ user." | |||
| 16820 | (when (< (nth 2 org-defdecode) org-extend-today-until) | 16816 | (when (< (nth 2 org-defdecode) org-extend-today-until) |
| 16821 | (setf (nth 2 org-defdecode) -1) | 16817 | (setf (nth 2 org-defdecode) -1) |
| 16822 | (setf (nth 1 org-defdecode) 59) | 16818 | (setf (nth 1 org-defdecode) 59) |
| 16823 | (setq org-def (apply #'encode-time org-defdecode)) | 16819 | (setq org-def (encode-time org-defdecode)) |
| 16824 | (setq org-defdecode (decode-time org-def))) | 16820 | (setq org-defdecode (decode-time org-def))) |
| 16825 | (let* ((timestr (format-time-string | 16821 | (let* ((timestr (format-time-string |
| 16826 | (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") | 16822 | (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") |
| @@ -16893,13 +16889,14 @@ user." | |||
| 16893 | "range representable on this machine")) | 16889 | "range representable on this machine")) |
| 16894 | (ding)) | 16890 | (ding)) |
| 16895 | 16891 | ||
| 16896 | ;; One round trip to get rid of 34th of August and stuff like that.... | 16892 | (setq final (apply #'encode-time final)) |
| 16897 | (setq final (decode-time (apply 'encode-time final))) | ||
| 16898 | 16893 | ||
| 16899 | (setq org-read-date-final-answer ans) | 16894 | (setq org-read-date-final-answer ans) |
| 16900 | 16895 | ||
| 16901 | (if to-time | 16896 | (if to-time |
| 16902 | (apply 'encode-time final) | 16897 | final |
| 16898 | ;; This round-trip gets rid of 34th of August and stuff like that.... | ||
| 16899 | (setq final (decode-time final)) | ||
| 16903 | (if (and (boundp 'org-time-was-given) org-time-was-given) | 16900 | (if (and (boundp 'org-time-was-given) org-time-was-given) |
| 16904 | (format "%04d-%02d-%02d %02d:%02d" | 16901 | (format "%04d-%02d-%02d %02d:%02d" |
| 16905 | (nth 5 final) (nth 4 final) (nth 3 final) | 16902 | (nth 5 final) (nth 4 final) (nth 3 final) |
| @@ -16929,7 +16926,7 @@ user." | |||
| 16929 | (and (boundp 'org-time-was-given) org-time-was-given)) | 16926 | (and (boundp 'org-time-was-given) org-time-was-given)) |
| 16930 | (cdr fmts) | 16927 | (cdr fmts) |
| 16931 | (car fmts))) | 16928 | (car fmts))) |
| 16932 | (txt (format-time-string fmt (apply 'encode-time f))) | 16929 | (txt (format-time-string fmt (apply #'encode-time f))) |
| 16933 | (txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) "]") txt)) | 16930 | (txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) "]") txt)) |
| 16934 | (txt (concat "=> " txt))) | 16931 | (txt (concat "=> " txt))) |
| 16935 | (when (and org-end-time-was-given | 16932 | (when (and org-end-time-was-given |
| @@ -17296,7 +17293,7 @@ The command returns the inserted time stamp." | |||
| 17296 | time (org-fix-decoded-time t1) | 17293 | time (org-fix-decoded-time t1) |
| 17297 | str (org-add-props | 17294 | str (org-add-props |
| 17298 | (format-time-string | 17295 | (format-time-string |
| 17299 | (substring tf 1 -1) (apply 'encode-time time)) | 17296 | (substring tf 1 -1) (encode-time time)) |
| 17300 | nil 'mouse-face 'highlight)) | 17297 | nil 'mouse-face 'highlight)) |
| 17301 | (put-text-property beg end 'display str))) | 17298 | (put-text-property beg end 'display str))) |
| 17302 | 17299 | ||
| @@ -17553,7 +17550,7 @@ days in order to avoid rounding problems." | |||
| 17553 | 17550 | ||
| 17554 | (defun org-time-string-to-time (s) | 17551 | (defun org-time-string-to-time (s) |
| 17555 | "Convert timestamp string S into internal time." | 17552 | "Convert timestamp string S into internal time." |
| 17556 | (apply #'encode-time (org-parse-time-string s))) | 17553 | (encode-time (org-parse-time-string s))) |
| 17557 | 17554 | ||
| 17558 | (defun org-time-string-to-seconds (s) | 17555 | (defun org-time-string-to-seconds (s) |
| 17559 | "Convert a timestamp string S into a number of seconds." | 17556 | "Convert a timestamp string S into a number of seconds." |
| @@ -17588,7 +17585,7 @@ signaled." | |||
| 17588 | (daynr (org-closest-date s daynr prefer)) | 17585 | (daynr (org-closest-date s daynr prefer)) |
| 17589 | (t (time-to-days | 17586 | (t (time-to-days |
| 17590 | (condition-case errdata | 17587 | (condition-case errdata |
| 17591 | (apply #'encode-time (org-parse-time-string s)) | 17588 | (org-time-string-to-time s) |
| 17592 | (error (error "Bad timestamp `%s'%s\nError was: %s" | 17589 | (error (error "Bad timestamp `%s'%s\nError was: %s" |
| 17593 | s | 17590 | s |
| 17594 | (if (not (and buffer pos)) "" | 17591 | (if (not (and buffer pos)) "" |
| @@ -17686,12 +17683,12 @@ stamp stay unchanged. In any case, return value is an absolute | |||
| 17686 | day number." | 17683 | day number." |
| 17687 | (if (not (string-match "\\+\\([0-9]+\\)\\([hdwmy]\\)" start)) | 17684 | (if (not (string-match "\\+\\([0-9]+\\)\\([hdwmy]\\)" start)) |
| 17688 | ;; No repeater. Do not shift time stamp. | 17685 | ;; No repeater. Do not shift time stamp. |
| 17689 | (time-to-days (apply #'encode-time (org-parse-time-string start))) | 17686 | (time-to-days (org-time-string-to-time start)) |
| 17690 | (let ((value (string-to-number (match-string 1 start))) | 17687 | (let ((value (string-to-number (match-string 1 start))) |
| 17691 | (type (match-string 2 start))) | 17688 | (type (match-string 2 start))) |
| 17692 | (if (= 0 value) | 17689 | (if (= 0 value) |
| 17693 | ;; Repeater with a 0-value is considered as void. | 17690 | ;; Repeater with a 0-value is considered as void. |
| 17694 | (time-to-days (apply #'encode-time (org-parse-time-string start))) | 17691 | (time-to-days (org-time-string-to-time start)) |
| 17695 | (let* ((base (org-date-to-gregorian start)) | 17692 | (let* ((base (org-date-to-gregorian start)) |
| 17696 | (target (org-date-to-gregorian current)) | 17693 | (target (org-date-to-gregorian current)) |
| 17697 | (sday (calendar-absolute-from-gregorian base)) | 17694 | (sday (calendar-absolute-from-gregorian base)) |
| @@ -18000,7 +17997,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like \"--2d\"." | |||
| 18000 | (setcar time0 (or (car time0) 0)) | 17997 | (setcar time0 (or (car time0) 0)) |
| 18001 | (setcar (nthcdr 1 time0) (or (nth 1 time0) 0)) | 17998 | (setcar (nthcdr 1 time0) (or (nth 1 time0) 0)) |
| 18002 | (setcar (nthcdr 2 time0) (or (nth 2 time0) 0)) | 17999 | (setcar (nthcdr 2 time0) (or (nth 2 time0) 0)) |
| 18003 | (setq time (apply 'encode-time time0)))) | 18000 | (setq time (encode-time time0)))) |
| 18004 | ;; Insert the new time-stamp, and ensure point stays in the same | 18001 | ;; Insert the new time-stamp, and ensure point stays in the same |
| 18005 | ;; category as before (i.e. not after the last position in that | 18002 | ;; category as before (i.e. not after the last position in that |
| 18006 | ;; category). | 18003 | ;; category). |
| @@ -23389,13 +23386,12 @@ strictly within a source block, use appropriate comment syntax." | |||
| 23389 | (defun org-timestamp--to-internal-time (timestamp &optional end) | 23386 | (defun org-timestamp--to-internal-time (timestamp &optional end) |
| 23390 | "Encode TIMESTAMP object into Emacs internal time. | 23387 | "Encode TIMESTAMP object into Emacs internal time. |
| 23391 | Use end of date range or time range when END is non-nil." | 23388 | Use end of date range or time range when END is non-nil." |
| 23392 | (apply #'encode-time | 23389 | (apply #'encode-time 0 |
| 23393 | (cons 0 | 23390 | (mapcar |
| 23394 | (mapcar | 23391 | (lambda (prop) (or (org-element-property prop timestamp) 0)) |
| 23395 | (lambda (prop) (or (org-element-property prop timestamp) 0)) | 23392 | (if end '(:minute-end :hour-end :day-end :month-end :year-end) |
| 23396 | (if end '(:minute-end :hour-end :day-end :month-end :year-end) | 23393 | '(:minute-start :hour-start :day-start :month-start |
| 23397 | '(:minute-start :hour-start :day-start :month-start | 23394 | :year-start))))) |
| 23398 | :year-start)))))) | ||
| 23399 | 23395 | ||
| 23400 | (defun org-timestamp-has-time-p (timestamp) | 23396 | (defun org-timestamp-has-time-p (timestamp) |
| 23401 | "Non-nil when TIMESTAMP has a time specified." | 23397 | "Non-nil when TIMESTAMP has a time specified." |
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el index 2cc2b189a1d..a4cf0f0ec01 100644 --- a/lisp/url/url-dav.el +++ b/lisp/url/url-dav.el | |||
| @@ -146,7 +146,7 @@ Returns nil if WebDAV is not supported." | |||
| 146 | (setq time (parse-time-string date-string))) | 146 | (setq time (parse-time-string date-string))) |
| 147 | 147 | ||
| 148 | (if time | 148 | (if time |
| 149 | (setq time (apply 'encode-time time)) | 149 | (setq time (encode-time time)) |
| 150 | (url-debug 'dav "Unable to decode date (%S) (%s)" | 150 | (url-debug 'dav "Unable to decode date (%S) (%s)" |
| 151 | (xml-node-name node) date-string)) | 151 | (xml-node-name node) date-string)) |
| 152 | time)) | 152 | time)) |
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 5df0a287d30..a4ff1cb4cd2 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el | |||
| @@ -650,7 +650,7 @@ Optional arg REVISION is a revision to annotate from." | |||
| 650 | "Return the current time, based at midnight of the current day, and | 650 | "Return the current time, based at midnight of the current day, and |
| 651 | encoded as fractional days." | 651 | encoded as fractional days." |
| 652 | (vc-annotate-convert-time | 652 | (vc-annotate-convert-time |
| 653 | (apply 'encode-time 0 0 0 (nthcdr 3 (decode-time))))) | 653 | (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time))))) |
| 654 | 654 | ||
| 655 | (defun vc-cvs-annotate-time () | 655 | (defun vc-cvs-annotate-time () |
| 656 | "Return the time of the next annotation (as fraction of days) | 656 | "Return the time of the next annotation (as fraction of days) |
| @@ -1184,9 +1184,8 @@ is non-nil." | |||
| 1184 | (car parsed-time) | 1184 | (car parsed-time) |
| 1185 | ;; Compare just the seconds part of the file time, | 1185 | ;; Compare just the seconds part of the file time, |
| 1186 | ;; since CVS file time stamp resolution is just 1 second. | 1186 | ;; since CVS file time stamp resolution is just 1 second. |
| 1187 | (let ((ptime (apply 'encode-time parsed-time))) | 1187 | (= (encode-time mtime 'integer) |
| 1188 | (and (eq (car mtime) (car ptime)) | 1188 | (encode-time parsed-time 'integer))) |
| 1189 | (eq (cadr mtime) (cadr ptime))))) | ||
| 1190 | (vc-file-setprop file 'vc-checkout-time mtime) | 1189 | (vc-file-setprop file 'vc-checkout-time mtime) |
| 1191 | (if set-state (vc-file-setprop file 'vc-state 'up-to-date))) | 1190 | (if set-state (vc-file-setprop file 'vc-state 'up-to-date))) |
| 1192 | (t | 1191 | (t |