home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / emacs / sources / 805 < prev    next >
Encoding:
Text File  |  1992-11-18  |  2.4 KB  |  71 lines

  1. Xref: sparky gnu.emacs.sources:805 gnu.emacs.help:4846
  2. Newsgroups: gnu.emacs.sources,gnu.emacs.help
  3. Path: 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
  4. From: jv@mh.nl (Johan Vromans)
  5. Subject: 24-hour time display
  6. Message-ID: <Bxx6vK.67H@pronto.mh.nl>
  7. X-Md4-Signature: 2782c51c64e376f8ff8bf9bcb4226530
  8. Sender: news@pronto.mh.nl (USEnet News System)
  9. Nntp-Posting-Host: largo:(jv)
  10. Organization: Multihouse Automation, the Netherlands
  11. Date: Wed, 18 Nov 1992 16:23:44 GMT
  12. Lines: 57
  13.  
  14. The following patch adds the variable display-time-ampm to time.el.
  15. Setting this variable to nil enables 24-hour time display.
  16.  
  17. Enjoy!
  18.  
  19. *** emacs-18.59/lisp/time.el    Tue Nov  3 10:04:55 1992
  20. --- /usr/tmp/time.el    Wed Nov 18 17:08:29 1992
  21. ***************
  22. *** 29,34 ****
  23. --- 29,37 ----
  24.   
  25.   (defvar display-time-string nil)
  26.   
  27. + (defvar display-time-ampm t
  28. +   "*If t, display time in AM/PM format. Otherwise use 24-hour format.")
  29.   (defun display-time ()
  30.     "Display current time and load level in mode line of each buffer.
  31.   Updates automatically every minute.
  32. ***************
  33. *** 94,107 ****
  34.                        (user-login-name)))))
  35.       hour pm)
  36.       (setq hour (read (substring time 11 13)))
  37. !     (setq pm (>= hour 12))
  38. !     (if (> hour 12)
  39. !     (setq hour (- hour 12))
  40. !       (if (= hour 0)
  41. !       (setq hour 12)))
  42.       (setq display-time-string
  43.         (concat (format "%d" hour) (substring time 13 16)
  44. !           (if pm "pm" "am")
  45.             (if (string= load "")
  46.                 ""
  47.               (concat " " (substring load 0 -2) "." (substring load -2)))
  48. --- 97,112 ----
  49.                        (user-login-name)))))
  50.       hour pm)
  51.       (setq hour (read (substring time 11 13)))
  52. !     (if display-time-ampm
  53. !     (progn
  54. !       (setq pm (>= hour 12))
  55. !       (if (> hour 12)
  56. !           (setq hour (- hour 12))
  57. !         (if (= hour 0)
  58. !         (setq hour 12)))))
  59.       (setq display-time-string
  60.         (concat (format "%d" hour) (substring time 13 16)
  61. !           (if display-time-ampm (if pm "pm" "am") "")
  62.             (if (string= load "")
  63.                 ""
  64.               (concat " " (substring load 0 -2) "." (substring load -2)))
  65. --
  66. Johan Vromans                       jv@mh.nl via internet backbones
  67. Multihouse Automatisering bv               uucp:..!{uunet,sun4nl}!mh.nl!jv
  68. Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62911/62500
  69. ------------------------ "Arms are made for hugging" -------------------------
  70.