diff options
| author | Paul Eggert | 2014-10-28 18:42:51 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-10-28 18:42:51 -0700 |
| commit | 123ddec7f807f4bd7400bbbe08219afb02269c00 (patch) | |
| tree | cac1153049785a70e015b32748521098956de5d8 /lisp/erc | |
| parent | 14e5809d3cc1fd89e50f88d5783219091596a271 (diff) | |
| download | emacs-123ddec7f807f4bd7400bbbe08219afb02269c00.tar.gz emacs-123ddec7f807f4bd7400bbbe08219afb02269c00.zip | |
Simplify use of current-time and friends.
* doc/misc/org.texi (Dynamic blocks):
* lisp/allout-widgets.el (allout-widgets-hook-error-handler):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/icalendar.el (icalendar--convert-float-to-ical):
* lisp/calendar/timeclock.el (timeclock-in, timeclock-when-to-leave)
(timeclock-last-period, timeclock-day-base):
* lisp/eshell/em-ls.el (eshell-ls-file):
* lisp/eshell/esh-util.el (eshell-parse-ange-ls):
* lisp/generic-x.el (named-database-print-serial):
* lisp/net/newst-backend.el (newsticker--get-news-by-url-callback)
(newsticker-get-news, newsticker--sentinel-work)
(newsticker--image-get, newsticker--image-sentinel):
* lisp/net/tramp-sh.el (tramp-get-remote-touch):
* lisp/progmodes/opascal.el (opascal-debug-log):
* lisp/textmodes/remember.el (remember-mail-date)
(remember-store-in-files):
* lisp/vc/vc-annotate.el (vc-annotate-display-autoscale)
(vc-default-annotate-current-time):
* lisp/vc/vc-bzr.el (vc-bzr-shelve-snapshot):
* lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time):
* lisp/vc/vc-rcs.el (vc-rcs-annotate-current-time):
* lisp/url/url-util.el (url-get-normalized-date):
* lisp/erc/erc-backend.el (TOPIC):
* lisp/gnus/gnus-delay.el (gnus-delay-article):
* lisp/gnus/gnus-sum.el (gnus-summary-read-document):
* lisp/gnus/gnus-util.el (gnus-seconds-today, gnus-seconds-month):
* lisp/gnus/message.el (message-make-expires-date):
* lisp/org/org-archive.el (org-archive-subtree)
(org-archive-to-archive-sibling):
* lisp/org/org-clock.el (org-resolve-clocks, org-clock-get-sum-start)
(org-clock-special-range):
* lisp/org/org-timer.el (org-timer-seconds):
* lisp/org/org.el (org-read-date-analyze, org-get-cursor-date):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-icalendar.el (org-icalendar--vtodo):
Omit unnecessary call to current-time.
* lisp/calendar/time-date.el (time-to-seconds) [!float-time]:
* lisp/calendar/timeclock.el (timeclock-time-to-date):
* lisp/vc/vc-annotate.el (vc-annotate-convert-time):
Use current time if arg is nil, to be compatible with float-time.
(time-date--day-in-year): New function, with most of the guts of
the old time-to-day-in-year.
(time-to-day-in-year): Use it.
(time-to-days): Use it, to avoid decoding the same time stamp twice.
* lisp/calendar/timeclock.el (timeclock-update-mode-line):
* lisp/cedet/srecode/args.el (srecode-semantic-handle-:time):
* lisp/gnus/gnus-util.el (gnus-seconds-year):
* lisp/org/org.el (org-get-cursor-date):
Don't call current-time twice to get the current time stamp,
as this can lead to inconsistent results.
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/erc/erc.el (erc-emacs-time-to-erc-time):
* lisp/ido.el (ido-time-stamp):
* lisp/vc/vc-annotate.el (vc-annotate-convert-time):
Simplify by using float-time.
* lisp/completion.el (save-completions-to-file):
* lisp/url/url-cache.el (url-cache-prune-cache):
Rename local var to avoid confusion.
* lisp/gnus/gnus-util.el (gnus-float-time):
* lisp/net/rcirc.el (rcirc-float-time):
* lisp/org/org-compat.el (org-float-time):
Simplify to an alias because time-to-seconds now behaves like float-time
with respect to nil arg.
* lisp/subr.el (progress-reporter-do-update):
Don't call float-time unless needed.
* lisp/erc/erc.el (erc-current-time): Simplify by using erc-emacs-time-to-erc-time.
* lisp/org/org-clock.el (org-clock-get-table-data): Omit unnecessary, lossy
conversion from floating point to Emacs time and back.
(org-resolve-clocks): Prefer two-argument floor.
Diffstat (limited to 'lisp/erc')
| -rw-r--r-- | lisp/erc/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/erc/erc-backend.el | 3 | ||||
| -rw-r--r-- | lisp/erc/erc.el | 14 |
3 files changed, 14 insertions, 10 deletions
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index efa3219db07..75a01581fcd 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-10-29 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Simplify use of current-time and friends. | ||
| 4 | * erc-backend.el (TOPIC): Omit unnecessary call to current-time. | ||
| 5 | * erc.el (erc-emacs-time-to-erc-time): Simplify by using float-time. | ||
| 6 | (erc-current-time): Simplify by using erc-emacs-time-to-erc-time. | ||
| 7 | |||
| 1 | 2014-10-20 Glenn Morris <rgm@gnu.org> | 8 | 2014-10-20 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * Merge in all changes up to 24.4 release. | 10 | * Merge in all changes up to 24.4 release. |
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 8751a194e3b..fb22f58822d 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el | |||
| @@ -1465,8 +1465,7 @@ add things to `%s' instead." | |||
| 1465 | "The channel topic has changed." nil | 1465 | "The channel topic has changed." nil |
| 1466 | (let* ((ch (car (erc-response.command-args parsed))) | 1466 | (let* ((ch (car (erc-response.command-args parsed))) |
| 1467 | (topic (erc-trim-string (erc-response.contents parsed))) | 1467 | (topic (erc-trim-string (erc-response.contents parsed))) |
| 1468 | (time (format-time-string erc-server-timestamp-format | 1468 | (time (format-time-string erc-server-timestamp-format))) |
| 1469 | (current-time)))) | ||
| 1470 | (pcase-let ((`(,nick ,login ,host) | 1469 | (pcase-let ((`(,nick ,login ,host) |
| 1471 | (erc-parse-user (erc-response.sender parsed)))) | 1470 | (erc-parse-user (erc-response.sender parsed)))) |
| 1472 | (erc-update-channel-member ch nick nick nil nil nil nil nil nil host login) | 1471 | (erc-update-channel-member ch nick nick nil nil nil nil nil nil host login) |
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index c70dfb94d7e..9363d4a8262 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -5956,17 +5956,15 @@ Returns a list of the form (HIGH LOW), compatible with Emacs time format." | |||
| 5956 | (list (truncate (/ n 65536)) | 5956 | (list (truncate (/ n 65536)) |
| 5957 | (truncate (mod n 65536))))) | 5957 | (truncate (mod n 65536))))) |
| 5958 | 5958 | ||
| 5959 | (defun erc-emacs-time-to-erc-time (time) | 5959 | (defalias 'erc-emacs-time-to-erc-time |
| 5960 | "Convert Emacs TIME to a number of seconds since the epoch." | 5960 | (if (featurep 'xemacs) 'time-to-seconds 'float-time) |
| 5961 | (when time | 5961 | "Convert time value TIME to a floating point number. |
| 5962 | (+ (* (nth 0 time) 65536.0) (nth 1 time)))) | 5962 | TIME defaults to the current time.") |
| 5963 | ; (round (+ (* (nth 0 tm) 65536.0) (nth 1 tm)))) | ||
| 5964 | 5963 | ||
| 5965 | (defun erc-current-time () | 5964 | (defalias 'erc-current-time 'erc-emacs-time-to-erc-time |
| 5966 | "Return the `current-time' as a number of seconds since the epoch. | 5965 | "Return the `current-time' as a number of seconds since the epoch. |
| 5967 | 5966 | ||
| 5968 | See also `erc-emacs-time-to-erc-time'." | 5967 | See also `erc-emacs-time-to-erc-time'.") |
| 5969 | (erc-emacs-time-to-erc-time (current-time))) | ||
| 5970 | 5968 | ||
| 5971 | (defun erc-time-diff (t1 t2) | 5969 | (defun erc-time-diff (t1 t2) |
| 5972 | "Return the time difference in seconds between T1 and T2." | 5970 | "Return the time difference in seconds between T1 and T2." |