unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* nnrss-normalize-date and timezone-parse-* can't parse Unix epoch time stamps (was: Not representable time)
       [not found]   ` <75f770a5-d087-45f3-ad61-0b041fa453fa@34g2000hsh.googlegroups.com>
@ 2008-05-12 14:32     ` Ted Zlatanov
  0 siblings, 0 replies; only message in thread
From: Ted Zlatanov @ 2008-05-12 14:32 UTC (permalink / raw)
  Cc: Emacs developers

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

On Fri, 9 May 2008 15:56:16 -0700 (PDT) Paulo Matos <pocmatos@gmail.com> wrote: 

PM> On May 7, 3:05 pm, Ted Zlatanov <t...@lifelogs.com> wrote:
>> On Tue, 6 May 2008 11:55:30 -0700 (PDT) Paulo Matos <pocma...@gmail.com> wrote:
>> 
PM> Hello all,
PM> I have added a couple of rss feeds to gnus the last time and now I
PM> get:
PM> Contacting host:www.techradar.com:80
PM> nnrss-normalize-date: Specified time is not representable
>> 
PM> And then Gnus doesn't start. This is really annoying. What can I do to
PM> either remove the feed or solve the issue? I need my Gnus back...
>> 
>> Can you provide the backtrace (do M-x toggle-debug-on-error) and the
>> address of the RSS feed, plus the specific contents if possible (in case
>> they go away meanwhile)?
>> 
>> Ted
PM> Here's the trace:

PM> Debugger entered--Lisp error: (error "Specified time is not
PM> representable")
PM>   encode-time(0 0 0 1 1 2095)
PM>   nnrss-normalize-date("1209546525")
PM>   nnrss-check-group("All Gaming Feeds" "")
PM>   nnrss-request-group("All Gaming Feeds" "" nil)
PM>   gnus-activate-group("nnrss:All Gaming Feeds" scan)
PM>   gnus-get-unread-articles(nil)
PM>   gnus-setup-news(nil nil nil)
PM>   byte-code("\b„\x0e

Hm, the docstring for nnrss-normalize-date says:

  "Return a date string of DATE in the RFC822 style.
This function handles the ISO 8601 date format described in
<URL:http://www.w3.org/TR/NOTE-datetime>, and also the RFC822 style
which RSS 2.0 allows."

but what you show is a Unix time stamp, which is not one of those
styles.  I checked RFC822 and a Unix time stamp is not allowed.  It
shouldn't break nnrss, though, and we may as well give correct data
instead of complaining.

The attached patch will let nnrss-normalize-date do the right thing with
that header, please try it and let me know if it works.  Perhaps it
should just call timezone-parse-* functions instead of rolling its own,
though.

Emacs developers: should timezone-parse-* in timezone.el also handle
Unix time stamps?  I think it makes sense to add that format.  The docs
say it's not currently supported.

Ted


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnrss.unix-date.patch --]
[-- Type: text/x-diff, Size: 1482 bytes --]

Index: nnrss.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/nnrss.el,v
retrieving revision 7.56
diff -c -r7.56 nnrss.el
*** nnrss.el	24 Apr 2008 04:19:21 -0000	7.56
--- nnrss.el	12 May 2008 14:20:51 -0000
***************
*** 500,507 ****
  This function handles the ISO 8601 date format described in
  <URL:http://www.w3.org/TR/NOTE-datetime>, and also the RFC822 style
  which RSS 2.0 allows."
!   (let (case-fold-search vector year month day time zone cts)
!     (cond ((null date))
  	  ;; RFC822
  	  ((string-match " [0-9]+ " date)
  	   (setq vector (timezone-parse-date date)
--- 500,510 ----
  This function handles the ISO 8601 date format described in
  <URL:http://www.w3.org/TR/NOTE-datetime>, and also the RFC822 style
  which RSS 2.0 allows."
!   (let (case-fold-search vector year month day time zone cts given)
!     (cond ((null date))			; do nothing for this case
! 	  ;; if the date is just digits (unix time stamp):
! 	  ((string-match "^[0-9]+$" date)
! 	   (setq given (seconds-to-time (string-to-number date))))
  	  ;; RFC822
  	  ((string-match " [0-9]+ " date)
  	   (setq vector (timezone-parse-date date)
***************
*** 559,565 ****
  		  (if zone
  		      (concat " " zone)
  		    "")))
!       (message-make-date))))
  
  ;;; data functions
  
--- 562,568 ----
  		  (if zone
  		      (concat " " zone)
  		    "")))
!       (message-make-date given))))
  
  ;;; data functions
  

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-12 14:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <df122f30-7861-4308-9ca6-d48b49fc7210@e39g2000hsf.googlegroups.com>
     [not found] ` <86skwuw6od.fsf@lifelogs.com>
     [not found]   ` <75f770a5-d087-45f3-ad61-0b041fa453fa@34g2000hsh.googlegroups.com>
2008-05-12 14:32     ` nnrss-normalize-date and timezone-parse-* can't parse Unix epoch time stamps (was: Not representable time) Ted Zlatanov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).