home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / emacs / gnus / 1449 < prev    next >
Encoding:
Text File  |  1993-01-05  |  4.1 KB  |  118 lines

  1. Newsgroups: gnu.emacs.gnus
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!twinsun.COM!eggert
  3. From: eggert@twinsun.COM (Paul Eggert)
  4. Subject: gnus 3.14.1 mishandles timezones that are not on hour boundaries
  5. Message-ID: <9301050533.AA10437@farside.twinsun.com>
  6. Sender: daemon@cis.ohio-state.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 5 Jan 1993 05:33:24 GMT
  10. Lines: 106
  11.  
  12. GNUS 3.14.1 assumes that time zones differ from GMT by an integral number of
  13. hours.  This doesn't work for India, which is GMT +0530.  Here's a patch.
  14.  
  15.  
  16. ===================================================================
  17. RCS file: timezone.el,v
  18. retrieving revision 3.14.1.1
  19. retrieving revision 3.14.1.2
  20. diff -c -r3.14.1.1 -r3.14.1.2
  21. *** timezone.el    1993/01/04 22:49:05    3.14.1.1
  22. --- timezone.el    1993/01/04 23:38:51    3.14.1.2
  23. ***************
  24. *** 66,75 ****
  25.        (second (string-to-int (aref time 2)))
  26.        (local  (or (aref date 4) local)) ;Use original if defined
  27.        (timezone (or timezone local))
  28. !      (diff   (- (timezone-zone-to-hour timezone)
  29. !             (timezone-zone-to-hour local)))
  30.        (new    (timezone-fix-time year month day
  31. !                     (+ hour diff) minute second)))
  32.       (timezone-make-arpa-date (aref new 0) (aref new 1) (aref new 2)
  33.                    (timezone-make-time-string
  34.                     (aref new 3) (aref new 4) (aref new 5))
  35. --- 66,75 ----
  36.        (second (string-to-int (aref time 2)))
  37.        (local  (or (aref date 4) local)) ;Use original if defined
  38.        (timezone (or timezone local))
  39. !      (diff   (- (timezone-zone-to-minute timezone)
  40. !             (timezone-zone-to-minute local)))
  41.        (new    (timezone-fix-time year month day
  42. !                     hour (+ minute diff) second)))
  43.       (timezone-make-arpa-date (aref new 0) (aref new 1) (aref new 2)
  44.                    (timezone-make-time-string
  45.                     (aref new 3) (aref new 4) (aref new 5))
  46. ***************
  47. *** 90,99 ****
  48.        (second (string-to-int (aref time 2)))
  49.        (local  (or (aref date 4) local)) ;Use original if defined
  50.        (timezone (or timezone local))
  51. !      (diff   (- (timezone-zone-to-hour timezone)
  52. !             (timezone-zone-to-hour local)))
  53.        (new    (timezone-fix-time year month day
  54. !                     (+ hour diff) minute second)))
  55.       (timezone-make-sortable-date (aref new 0) (aref new 1) (aref new 2)
  56.                    (timezone-make-time-string
  57.                     (aref new 3) (aref new 4) (aref new 5)))
  58. --- 90,99 ----
  59.        (second (string-to-int (aref time 2)))
  60.        (local  (or (aref date 4) local)) ;Use original if defined
  61.        (timezone (or timezone local))
  62. !      (diff   (- (timezone-zone-to-minute timezone)
  63. !             (timezone-zone-to-minute local)))
  64.        (new    (timezone-fix-time year month day
  65. !                     hour (+ minute diff) second)))
  66.       (timezone-make-sortable-date (aref new 0) (aref new 1) (aref new 2)
  67.                    (timezone-make-time-string
  68.                     (aref new 3) (aref new 4) (aref new 5)))
  69. ***************
  70. *** 210,217 ****
  71.   
  72.   ;; Miscellaneous
  73.   
  74. ! (defun timezone-zone-to-hour (timezone)
  75. !   "Translate TIMEZONE (in zone name or integer) to integer hour."
  76.     (if timezone
  77.         (progn
  78.       (setq timezone
  79. --- 210,217 ----
  80.   
  81.   ;; Miscellaneous
  82.   
  83. ! (defun timezone-zone-to-minute (timezone)
  84. !   "Translate TIMEZONE (in zone name or integer) to integer minute."
  85.     (if timezone
  86.         (progn
  87.       (setq timezone
  88. ***************
  89. *** 220,230 ****
  90.             timezone))
  91.       (if (stringp timezone)
  92.           (setq timezone (string-to-int timezone)))
  93. !     (/ timezone 100))
  94.       0))
  95.   
  96.   (defun timezone-fix-time (year month day hour minute second)
  97.     "Fix date and time."
  98.     (cond ((<= 24 hour)            ;24 -> 00
  99.        (setq hour (- hour 24))
  100.        (setq day  (1+ day))
  101. --- 220,235 ----
  102.             timezone))
  103.       (if (stringp timezone)
  104.           (setq timezone (string-to-int timezone)))
  105. !     (let* ((abszone (max timezone (- timezone)))
  106. !            (minutes (+ (* 60 (/ abszone 100)) (% abszone 100))))
  107. !       (if (< timezone 0) (- minutes) minutes)))
  108.       0))
  109.   
  110.   (defun timezone-fix-time (year month day hour minute second)
  111.     "Fix date and time."
  112. +   (let ((hourfix (if (< minute 0) (- (/ (- 59 minute) 60)) (/ minute 60))))
  113. +     (setq hour (+ hour hourfix))
  114. +     (setq minute (- minute (* 60 hourfix))))
  115.     (cond ((<= 24 hour)            ;24 -> 00
  116.        (setq hour (- hour 24))
  117.        (setq day  (1+ day))
  118.