home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / patches / 24-hour-time.el next >
Encoding:
Text File  |  1992-11-25  |  2.0 KB  |  66 lines

  1. ; Path: hal.com!olivea!charnel!rat!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!unidui!Germany.EU.net!mcsun!sun4nl!mhres!pronto!news
  2. ; From: jv@mh.nl (Johan Vromans)
  3. ; Newsgroups: gnu.emacs.sources,gnu.emacs.help
  4. ; Subject: 24-hour time display
  5. ; Date: 18 Nov 92 16:23:44 GMT
  6. ; Organization: Multihouse Automation, the Netherlands
  7. ; The following patch adds the variable display-time-ampm to time.el.
  8. ; Setting this variable to nil enables 24-hour time display.
  9. ; Enjoy!
  10.  
  11. ; LCD Archive Entry:
  12. ; 24-hour-time|Johan Vromans|jv@mh.nl|
  13. ; Adds 24 time display capability to time.el.|
  14. ; 92-11-18||~/patches/24-hour-time.el.Z|
  15.  
  16. ; *** emacs-18.59/lisp/time.el    Tue Nov  3 10:04:55 1992
  17. ; --- /usr/tmp/time.el    Wed Nov 18 17:08:29 1992
  18. ; ***************
  19. ; *** 29,34 ****
  20. ; --- 29,37 ----
  21. ;   
  22.   (defvar display-time-string nil)
  23.   
  24. + (defvar display-time-ampm t
  25. +   "*If t, display time in AM/PM format. Otherwise use 24-hour format.")
  26.   (defun display-time ()
  27.     "Display current time and load level in mode line of each buffer.
  28.   Updates automatically every minute.
  29. ***************
  30. *** 94,107 ****
  31.                        (user-login-name)))))
  32.       hour pm)
  33.       (setq hour (read (substring time 11 13)))
  34. !     (setq pm (>= hour 12))
  35. !     (if (> hour 12)
  36. !     (setq hour (- hour 12))
  37. !       (if (= hour 0)
  38. !       (setq hour 12)))
  39.       (setq display-time-string
  40.         (concat (format "%d" hour) (substring time 13 16)
  41. !           (if pm "pm" "am")
  42.             (if (string= load "")
  43.                 ""
  44.               (concat " " (substring load 0 -2) "." (substring load -2)))
  45. --- 97,112 ----
  46.                        (user-login-name)))))
  47.       hour pm)
  48.       (setq hour (read (substring time 11 13)))
  49. !     (if display-time-ampm
  50. !     (progn
  51. !       (setq pm (>= hour 12))
  52. !       (if (> hour 12)
  53. !           (setq hour (- hour 12))
  54. !         (if (= hour 0)
  55. !         (setq hour 12)))))
  56.       (setq display-time-string
  57.         (concat (format "%d" hour) (substring time 13 16)
  58. !           (if display-time-ampm (if pm "pm" "am") "")
  59.             (if (string= load "")
  60.                 ""
  61.               (concat " " (substring load 0 -2) "." (substring load -2)))
  62.