Gnus development mailing list
 help / color / mirror / Atom feed
* date
@ 1998-09-11  5:50 Katsumi Yamaoka
  1998-09-11  5:56 ` date Katsumi Yamaoka
  1998-09-11  6:20 ` date Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 1998-09-11  5:50 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

The last argument for encode-time() must be TZ. However, the last
element of list from parse-time-string() is nil. I wonder the number
of ellements from parse-time-string() exceeds right one by one.

And one another thing. When we calculate UT in article-make-date-line(),
only to input zero to TZ don't make the right value.

This is the patch for it.

[-- Attachment #2: pgnus-0.24-date.patch --]
[-- Type: application/octet-stream, Size: 1842 bytes --]

--- pgnus-0.24/lisp/gnus-art.el~	Thu Sep 10 11:01:51 1998
+++ pgnus-0.24/lisp/gnus-art.el	Fri Sep 11 14:41:46 1998
@@ -1352,17 +1352,26 @@
      ;; functions since they aren't particularly resistant to
      ;; buggy dates.
      ((eq type 'local)
-      (concat "Date: " (current-time-string time)))
+      (let ((tz (car (current-time-zone))))
+	(format "Date: %s %s%04d" (current-time-string time)
+		(if (> tz 0) "+" "-") (abs (/ tz 36)))))
      ;; Convert to Universal Time.
      ((eq type 'ut)
       (concat "Date: "
 	      (current-time-string
-	       (let ((e (parse-time-string date)))
-		 (setcar (last e) 0)
-		 (apply 'encode-time e)))))
+	       (let* ((e (parse-time-string date))
+		     (tm (apply 'encode-time e))
+		     (ms (car tm))
+		     (ls (- (cadr tm) (car (current-time-zone)))))
+		 (cond ((< ls 0) (list (1- ms) (+ ls 65536)))
+		       ((> ls 65535) (list (1+ ms) (- ls 65536)))
+		       (t (list ms ls)))))
+	      " UT"))
      ;; Get the original date from the article.
      ((eq type 'original)
-      (concat "Date: " date))
+      (concat "Date: " (if (string-match "\n+$" date)
+			   (substring date 0 (match-beginning 0))
+			 date)))
      ;; Let the user define the format.
      ((eq type 'user)
       (if (gnus-functionp gnus-article-time-format)
--- pgnus-0.24/lisp/parse-time.el~	Thu Sep 10 11:01:53 1998
+++ pgnus-0.24/lisp/parse-time.el	Fri Sep 11 14:41:46 1998
@@ -169,7 +169,7 @@
   "Parse the time-string STRING into (SEC MIN HOUR DAY MON YEAR DOW DST TZ).
 The values are identical to those of `decode-time', but any values that are
 unknown are returned as nil."
-  (let ((time (list nil nil nil nil nil nil nil nil nil nil))
+  (let ((time (list nil nil nil nil nil nil nil nil nil))
 	(temp (parse-time-tokenize (downcase string))))
     (while temp
       (let ((elt (pop temp))

[-- Attachment #3: Type: text/plain, Size: 44 bytes --]

-- 
Katsumi Yamaoka <yamaoka@ga.sony.co.jp>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-09-11 13:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-11  5:50 date Katsumi Yamaoka
1998-09-11  5:56 ` date Katsumi Yamaoka
1998-09-11  6:22   ` date Lars Magne Ingebrigtsen
1998-09-11 13:56     ` date Katsumi Yamaoka
1998-09-11  6:20 ` date Lars Magne Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).