aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1991-08-13 15:58:15 +0000
committerJim Blandy1991-08-13 15:58:15 +0000
commitc2be0af47ad304f060c7e783b364a0bf40685695 (patch)
tree965bbcf14ab46b003e5847967815d624e5f7af9d
parent5bce042c029e374b749f1661d1ada14d84c87440 (diff)
downloademacs-c2be0af47ad304f060c7e783b364a0bf40685695.tar.gz
emacs-c2be0af47ad304f060c7e783b364a0bf40685695.zip
*** empty log message ***
-rw-r--r--lisp/time.el26
1 files changed, 17 insertions, 9 deletions
diff --git a/lisp/time.el b/lisp/time.el
index fe29ca567df..27485bee64a 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -31,6 +31,10 @@ Default is system-dependent, and is the same as used by Rmail.")
31(defvar display-time-interval 60 31(defvar display-time-interval 60
32 "*Seconds between updates of time in the mode line.") 32 "*Seconds between updates of time in the mode line.")
33 33
34(defvar display-time-24hr-format nil
35 "Non-nill indicates time should be displayed as hh:mm, 0 <= hh <= 23.
36Nil means 1 <= hh <= 12, and an AM/PM suffix is used.")
37
34(defvar display-time-string nil) 38(defvar display-time-string nil)
35 39
36(defvar display-time-hook nil 40(defvar display-time-hook nil
@@ -75,7 +79,8 @@ After each update, `display-time-hook' is run with `run-hooks'."
75 (let ((time (current-time-string)) 79 (let ((time (current-time-string))
76 (load (condition-case () 80 (load (condition-case ()
77 (if (zerop (car (load-average))) "" 81 (if (zerop (car (load-average))) ""
78 (format "%03d" (car (load-average)))) 82 (let ((str (format " %03d" (car (load-average)))))
83 (concat (substring str 0 -2) "." (substring str -2))))
79 (error ""))) 84 (error "")))
80 (mail-spool-file (or display-time-mail-file 85 (mail-spool-file (or display-time-mail-file
81 (getenv "MAIL") 86 (getenv "MAIL")
@@ -83,17 +88,20 @@ After each update, `display-time-hook' is run with `run-hooks'."
83 (or (getenv "LOGNAME") 88 (or (getenv "LOGNAME")
84 (getenv "USER") 89 (getenv "USER")
85 (user-login-name))))) 90 (user-login-name)))))
86 hour pm) 91 hour am-pm-flag)
87 (setq hour (read (substring time 11 13))) 92 (setq hour (read (substring time 11 13)))
88 (setq pm (>= hour 12)) 93 (if (not display-time-24hr-format)
89 (if (> hour 12) 94 (progn
90 (setq hour (- hour 12)) 95 (setq am-pm-flag (if (>= hour 12) "pm" "am"))
91 (if (= hour 0) 96 (if (> hour 12)
92 (setq hour 12))) 97 (setq hour (- hour 12))
98 (if (= hour 0)
99 (setq hour 12))))
100 (setq am-pm-flag ""))
93 (setq display-time-string 101 (setq display-time-string
94 (concat (format "%d" hour) (substring time 13 16) 102 (concat (format "%d" hour) (substring time 13 16)
95 (if pm "pm " "am ") 103 am-pm-flag
96 (substring load 0 -2) "." (substring load -2) 104 load
97 (if (and (file-exists-p mail-spool-file) 105 (if (and (file-exists-p mail-spool-file)
98 ;; file not empty? 106 ;; file not empty?
99 (display-time-file-nonempty-p mail-spool-file)) 107 (display-time-file-nonempty-p mail-spool-file))