summaryrefslogtreecommitdiff
path: root/lisp/erc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/erc')
-rw-r--r--lisp/erc/ChangeLog7
-rw-r--r--lisp/erc/erc-backend.el3
-rw-r--r--lisp/erc/erc.el14
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 @@
+2014-10-29 Paul Eggert <eggert@cs.ucla.edu>
+
+ Simplify use of current-time and friends.
+ * erc-backend.el (TOPIC): Omit unnecessary call to current-time.
+ * erc.el (erc-emacs-time-to-erc-time): Simplify by using float-time.
+ (erc-current-time): Simplify by using erc-emacs-time-to-erc-time.
+
2014-10-20 Glenn Morris <rgm@gnu.org>
* 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."
"The channel topic has changed." nil
(let* ((ch (car (erc-response.command-args parsed)))
(topic (erc-trim-string (erc-response.contents parsed)))
- (time (format-time-string erc-server-timestamp-format
- (current-time))))
+ (time (format-time-string erc-server-timestamp-format)))
(pcase-let ((`(,nick ,login ,host)
(erc-parse-user (erc-response.sender parsed))))
(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."
(list (truncate (/ n 65536))
(truncate (mod n 65536)))))
-(defun erc-emacs-time-to-erc-time (time)
- "Convert Emacs TIME to a number of seconds since the epoch."
- (when time
- (+ (* (nth 0 time) 65536.0) (nth 1 time))))
-; (round (+ (* (nth 0 tm) 65536.0) (nth 1 tm))))
+(defalias 'erc-emacs-time-to-erc-time
+ (if (featurep 'xemacs) 'time-to-seconds 'float-time)
+ "Convert time value TIME to a floating point number.
+TIME defaults to the current time.")
-(defun erc-current-time ()
+(defalias 'erc-current-time 'erc-emacs-time-to-erc-time
"Return the `current-time' as a number of seconds since the epoch.
-See also `erc-emacs-time-to-erc-time'."
- (erc-emacs-time-to-erc-time (current-time)))
+See also `erc-emacs-time-to-erc-time'.")
(defun erc-time-diff (t1 t2)
"Return the time difference in seconds between T1 and T2."