Gnus development mailing list
 help / color / mirror / Atom feed
From: visigoth@naiad.fac.cs.cmu.edu
Subject: Re: Statistics'R'Us
Date: 22 Jan 1997 03:00:18 -0500	[thread overview]
Message-ID: <vpd3evunnql.fsf@naiad.fac.cs.cmu.edu> (raw)
In-Reply-To: Lars Magne Ingebrigtsen's message of 22 Jan 1997 00:09:35 +0100

Hmm.

(nnmail-date-to-time "21 Jan 1997 14:00:00")       => (13029  4656)
(nnmail-date-to-time "21 Jan 1997 14:00:00 +0000") => (13028 52192)
(nnmail-date-to-time "21 Jan 1997 13:00:00 -0100") => (13028 48692)
(nnmail-date-to-time "21 Jan 1997 12:00:00 -0200") => (13028 45192)

Hmm.  Those numbers shouldn't be changing...  But they are, and in
increments of 3500...  I wonder...

(nnmail-date-to-time "21 Jan 1997 14:00:00 +0001") => (13028 52191)

Oho!

It looks like you are counting the timezone delta in SECONDS, and
that's just not right.  :)  One moment...

(nnmail-date-to-time "21 Jan 1997 13:00:00 -3600") => (13028 52192)

Let's see if I can get you a fix:


Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:

> (defun nnmail-date-to-time (date)
>   "Convert DATE into time."
>   (condition-case ()
>       (let* ((d1 (timezone-parse-date date))
> 	       (t1 (timezone-parse-time (aref d1 3)))
---insert
<              (tz (aref d1 4))
<              (tzh (substr tz 0 2))
<              (tzm (substr tz 2 4))
<              (tzs (concat (+ (* 3600 tzh) (* 60 tzm))))
---done
>)
> 	(apply 'encode-time
> 	       (mapcar (lambda (el)
> 			 (and el (string-to-number el)))
> 		       (list
> 			(aref t1 2) (aref t1 1) (aref t1 0)
> 			(aref d1 2) (aref d1 1) (aref d1 0)
---Replace the below
> 			(aref d1 4)))))
----------------------
<			tzs))))
---done replacing
>     ;; If we get an error, then we just return a 0 time.
>     (error (list 0 0))))
> 
> What's wrong here?

The above is correct, I believe, but probably not optimal.  For one
thing, I can't recall another way to turn a number into a string, and
for another, I'm working around the mapcar by doing it.

This is a nice bug to fix, BTW.  :) It must result in some interesting
date comparisons.

John.


  reply	other threads:[~1997-01-22  8:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-16  4:11 Statistics'R'Us Lars Magne Ingebrigtsen
1997-01-21 15:43 ` Statistics'R'Us visigoth
1997-01-21 16:56   ` Statistics'R'Us Jason R. Mastaler
1997-01-21 19:55     ` Statistics'R'Us visigoth
1997-01-21 23:09       ` Statistics'R'Us Lars Magne Ingebrigtsen
1997-01-22  8:00         ` visigoth [this message]
1997-01-23  2:41           ` Statistics'R'Us Lars Magne Ingebrigtsen
1997-01-23  4:33             ` Statistics'R'Us visigoth
1997-01-23  9:14               ` Statistics'R'Us Lars Magne Ingebrigtsen
1997-01-23 10:59                 ` Statistics'R'Us visigoth
1997-01-23 11:12                   ` Statistics'R'Us Lars Magne Ingebrigtsen

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=vpd3evunnql.fsf@naiad.fac.cs.cmu.edu \
    --to=visigoth@naiad.fac.cs.cmu.edu \
    /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).