* `ask-server' does not work in the Far East
@ 2001-07-19 3:08 Katsumi Yamaoka
2001-07-20 19:06 ` ShengHuo ZHU
0 siblings, 1 reply; 2+ messages in thread
From: Katsumi Yamaoka @ 2001-07-19 3:08 UTC (permalink / 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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: `ask-server' does not work in the Far East
2001-07-19 3:08 `ask-server' does not work in the Far East Katsumi Yamaoka
@ 2001-07-20 19:06 ` ShengHuo ZHU
0 siblings, 0 replies; 2+ messages in thread
From: ShengHuo ZHU @ 2001-07-20 19:06 UTC (permalink / raw)
Katsumi Yamaoka <yamaoka@jpl.org> writes:
[...]
> 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.
Installed. Thanks.
ShengHuo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-07-20 19:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-19 3:08 `ask-server' does not work in the Far East Katsumi Yamaoka
2001-07-20 19:06 ` ShengHuo ZHU
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).