comparison lisp/time.el @ 387:8f76cc1e1067

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Tue, 13 Aug 1991 15:58:15 +0000
parents d548f9619751
children fec3f9a1e3e5
comparison
equal deleted inserted replaced
386:6acd2a203aa8 387:8f76cc1e1067
28 28
29 (defvar display-time-process nil) 29 (defvar display-time-process nil)
30 30
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
34 (defvar display-time-24hr-format nil
35 "Non-nill indicates time should be displayed as hh:mm, 0 <= hh <= 23.
36 Nil means 1 <= hh <= 12, and an AM/PM suffix is used.")
33 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
37 "* List of functions to be called when the time is updated on the mode line.") 41 "* List of functions to be called when the time is updated on the mode line.")
73 77
74 (defun display-time-filter (proc string) 78 (defun display-time-filter (proc string)
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")
82 (concat rmail-spool-directory 87 (concat rmail-spool-directory
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))
100 " Mail" 108 " Mail"
101 ""))) 109 "")))