From 243dfffb77a01499d52e76409c5aba8b97527364 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 27 Feb 1996 17:44:45 +0000 Subject: [PATCH] (display-time): Use run-at-time to start the timer. --- lisp/time.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lisp/time.el b/lisp/time.el index 76c3b08bbdd..b6cc833ca4e 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -63,18 +63,15 @@ If `display-time-day-and-date' is non-nil, the current day and date are displayed as well. After each update, `display-time-hook' is run with `run-hooks'." (interactive) - (require 'timer) - (if (timerp display-time-timer) - (cancel-timer display-time-timer) - (setq display-time-timer (timer-create))) (setq display-time-string "") (or global-mode-string (setq global-mode-string '(""))) (or (memq 'display-time-string global-mode-string) (setq global-mode-string (append global-mode-string '(display-time-string)))) - (timer-set-time display-time-timer (current-time) display-time-interval) - (timer-set-function display-time-timer 'display-time-event-handler) - (timer-activate display-time-timer) + ;; Setup the time timer. + (and display-time-timer (cancel-timer display-time-timer)) + (setq display-time-timer + (run-at-time nil display-time-interval 'display-time-event-handler)) ;; When you get new mail, clear "Mail" from the mode line. (add-hook 'rmail-get-new-mail-hook 'display-time-event-handler)) -- 2.39.2