bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6957: url-cookie-expired-p Redux (at last)


From: shawn boles
Subject: bug#6957: url-cookie-expired-p Redux (at last)
Date: Thu, 2 Sep 2010 10:13:39 -0700

On Tue, Aug 31, 2010 at 4:39 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> (float-time) already gives the seconds since epoch.  No need to convert
> to string and back, or doing any time zone adjustments.

I spent yesterday laid up with a cold. Between naps I found myself
coming back to (url-cookie-expired-p) and Andreas' response to my GMT
conversion. I kept thinking that there must be kernel of wisdom for
this grasshopper to find.

I would like to suggest the following replacement for
(url-cookie-expired-p); please see attached patch.

(defun url-cookie-expired-p (cookie)
        (let* ((exp (url-cookie-expires cookie))
                                 (exp-time (and exp (float-time (date-to-time 
exp)))))
                (if (not exp) nil
                        (> (float-time) exp-time))))

If the cookie has an expiration date, (float-time (date-to-time exp))
takes care of converting this to a float time, adjusted to the
client's time zone. Then all we need to do is compare this exp-time
against (float-time).

As an added bonus, we can now remove the url-cookie dependency on timezone.

shawn

Attachment: url-cookie.el.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]