🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.sources
Article #227

24-hour time display

#227
From: Johan Vromans
Date: Wed, 18 Nov 1992 16:23
57 lines
2426 bytes
The following patch adds the variable display-time-ampm to time.el.
Setting this variable to nil enables 24-hour time display.

Enjoy!

*** emacs-18.59/lisp/time.el	Tue Nov  3 10:04:55 1992
--- /usr/tmp/time.el	Wed Nov 18 17:08:29 1992
***************
*** 29,34 ****
--- 29,37 ----
  
  (defvar display-time-string nil)
  
+ (defvar display-time-ampm t
+   "*If t, display time in AM/PM format. Otherwise use 24-hour format.")
+ 
  (defun display-time ()
    "Display current time and load level in mode line of each buffer.
  Updates automatically every minute.
***************
*** 94,107 ****
  					 (user-login-name)))))
  	hour pm)
      (setq hour (read (substring time 11 13)))
!     (setq pm (>= hour 12))
!     (if (> hour 12)
! 	(setq hour (- hour 12))
!       (if (= hour 0)
! 	  (setq hour 12)))
      (setq display-time-string
  	  (concat (format "%d" hour) (substring time 13 16)
! 		  (if pm "pm" "am")
  		  (if (string= load "")
  		      ""
  		    (concat " " (substring load 0 -2) "." (substring load -2)))
--- 97,112 ----
  					 (user-login-name)))))
  	hour pm)
      (setq hour (read (substring time 11 13)))
!     (if display-time-ampm
! 	(progn
! 	  (setq pm (>= hour 12))
! 	  (if (> hour 12)
! 	      (setq hour (- hour 12))
! 	    (if (= hour 0)
! 		(setq hour 12)))))
      (setq display-time-string
  	  (concat (format "%d" hour) (substring time 13 16)
! 		  (if display-time-ampm (if pm "pm" "am") "")
  		  (if (string= load "")
  		      ""
  		    (concat " " (substring load 0 -2) "." (substring load -2)))
--
Johan Vromans				       jv@mh.nl via internet backbones
Multihouse Automatisering bv		       uucp:..!{uunet,sun4nl}!mh.nl!jv
Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62911/62500
------------------------ "Arms are made for hugging" -------------------------
Technical Details
Message-ID: <Bxx6vK.67H@pronto.mh.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!hubcap!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!math.fu-berlin.de!unidui!Germany.EU.net!mcsun!sun4nl!mhres!pronto!news

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.sources,gnu.emacs.help
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!hubcap!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!math.fu-berlin.de!unidui!Germany.EU.net!mcsun!sun4nl!mhres!pronto!news
From: jv@mh.nl (Johan Vromans)
Subject: 24-hour time display
Message-ID: <Bxx6vK.67H@pronto.mh.nl>
X-Md4-Signature: 2782c51c64e376f8ff8bf9bcb4226530
Sender: news@pronto.mh.nl (USEnet News System)
Nntp-Posting-Host: largo:(jv)
Organization: Multihouse Automation, the Netherlands
Date: Wed, 18 Nov 1992 16:23:44 GMT
Lines: 57