Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
Subject: `ask-server' does not work in the Far East
Date: Thu, 19 Jul 2001 12:08:35 +0900	[thread overview]
Message-ID: <yosusnftd39o.fsf@jpl.org> (raw)

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

Hi,

`ask-server' the default value of `gnus-check-new-newsgroups' is
unfair to people who live in east of Greenwich.  Sorry, it is a
joke, but there is a real problem.

I live in Japan, the value of timezone is +0900.  Gnus keeps the
last time that Gnus asked server for the new newsgroups in the
variable `gnus-newsrc-last-checked-date'.  The value is made by
the function `current-time-string' which does not have a zone
info.  For example, if .newsrc.eld has the following line:

(setq gnus-newsrc-last-checked-date '"Wed Jul 18 22:12:34 2001")

Early in the next morning, Gnus will ask server for the new
newsgroups using the following NNTP command:

NEWGROUPS 010719 071234

The reason why the value is not "010718 221234" is:

(format-time-string "%y%m%d %H%M%S"
		    (date-to-time "Wed Jul 18 22:12:34 2001"))
 => "010719 071234"

Because of this, I could not see the new newsgroups which were
created at midnight.

Thus the value of `gnus-newsrc-last-checked-date' should have a
zone info.  Furthermore, NEWGROUPS command should be expressed
in UTC, because not all the servers are running in the same time
zone with the clients.


2001-07-19  Katsumi Yamaoka  <yamaoka@jpl.org>

	* nntp.el (nntp-request-newgroups): Use UTC date for NEWGROUPS
	command.

	* gnus-start.el (gnus-find-new-newsgroups): Use
	`message-make-date' instead of `current-time-string'.
	(gnus-ask-server-for-new-groups): Ditto.
	(gnus-check-first-time-used): Ditto.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-ask-server --]
[-- Type: text/x-patch, Size: 2451 bytes --]

--- gnus-start.el~	Tue Jul  3 21:50:55 2001
+++ gnus-start.el	Thu Jul 19 01:20:38 2001
@@ -1018,7 +1018,7 @@
 	  (gnus-message 5 "Looking for new newsgroups...")
 	  (unless gnus-have-read-active-file
 	    (gnus-read-active-file))
-	  (setq gnus-newsrc-last-checked-date (current-time-string))
+	  (setq gnus-newsrc-last-checked-date (message-make-date))
 	  (unless gnus-killed-hashtb
 	    (gnus-make-hashtable-from-killed))
 	  ;; Go though every newsgroup in `gnus-active-hashtb' and compare
@@ -1083,7 +1083,8 @@
       (and regs (cdar regs))))))
 
 (defun gnus-ask-server-for-new-groups ()
-  (let* ((date (or gnus-newsrc-last-checked-date (current-time-string)))
+  (let* ((new-date (message-make-date))
+	 (date (or gnus-newsrc-last-checked-date new-date))
 	 (methods (cons gnus-select-method
 			(nconc
 			 (when (gnus-archive-server-wanted-p)
@@ -1093,7 +1094,6 @@
 			       gnus-check-new-newsgroups)
 			  gnus-secondary-select-methods))))
 	 (groups 0)
-	 (new-date (current-time-string))
 	 group new-newsgroups got-new method hashtb
 	 gnus-override-subscribe-method)
     (unless gnus-killed-hashtb
@@ -1169,7 +1169,7 @@
     (unless (gnus-read-active-file-p)
       (let ((gnus-read-active-file t))
 	(gnus-read-active-file)))
-    (setq gnus-newsrc-last-checked-date (current-time-string))
+    (setq gnus-newsrc-last-checked-date (message-make-date))
     ;; Subscribe to the default newsgroups.
     (let ((groups (or gnus-default-subscribed-newsgroups
 		      gnus-backup-default-subscribed-newsgroups))
--- nntp.el~	Mon Jul  9 21:51:56 2001
+++ nntp.el	Thu Jul 19 01:20:38 2001
@@ -817,11 +817,22 @@
   (nntp-possibly-change-group nil server)
   (save-excursion
     (set-buffer nntp-server-buffer)
-    (prog1
-	(nntp-send-command
-	 "^\\.\r?\n" "NEWGROUPS"
-	 (format-time-string "%y%m%d %H%M%S" (date-to-time date)))
-      (nntp-decode-text))))
+    (let* ((time (date-to-time date))
+	   (ls (- (cadr time) (nth 8 (decode-time time)))))
+      (cond ((< ls 0)
+	     (setcar time (1- (car time)))
+	     (setcar (cdr time) (+ ls 65536)))
+	    ((>= ls 65536)
+	     (setcar time (1+ (car time)))
+	     (setcar (cdr time) (- ls 65536)))
+	    (t
+	     (setcar (cdr time) ls)))
+      (prog1
+	  (nntp-send-command
+	   "^\\.\r?\n" "NEWGROUPS"
+	   (format-time-string "%y%m%d %H%M%S" time)
+	   "GMT")
+	(nntp-decode-text)))))
 
 (deffoo nntp-request-post (&optional server)
   (nntp-possibly-change-group nil server)

             reply	other threads:[~2001-07-19  3:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-19  3:08 Katsumi Yamaoka [this message]
2001-07-20 19:06 ` ShengHuo ZHU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yosusnftd39o.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).