[Top][All Lists]

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

Re: variables for yesterday and today

From: ken
Subject: Re: variables for yesterday and today
Date: Wed, 16 Oct 2002 10:05:13 -0400 (EDT)

Spake foomaster1200 at 05:25 (UTC-0000) on Wed, 16 Oct 2002:

= ken <> writes:
= > Yes, that's much better.  But it occurs to me also that this always 
= > resolves to 65536.  So why not just use the constant and save processing 
= > time?  The answer is that this would cause an overflow.  
= Because I wanted to make it plainly obvious how it works.
= ...

And this is good practice... much appreciated.  It was mentioned just to 
see if the group saw any possible holes in my thinking in the logic.

Documentation in the code's comments could accomplish this also, while
still producing faster code.  Different strokes, I guess.

Upon testing the function (the slightly revised version of it) I found 
that it doesn't actually return yesterday's date (i.e., yesterday's 
current-time), but rather tomorrow's.  So how would we alter this to get 

(defun yesterday-time ()
  (let ((1day-lsw (% 86400 (lsh 1 16)))
        (1day-msw (/ 86400 (lsh 1 16)))
        (now (current-time)))
     (+ (car now) 1day-msw) 
     (+ (car (cdr now)) 1day-lsw) 
     (car (cdr (cdr now))))))

Thanks very much,

AMD crashes?  See

reply via email to

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