From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Re: variables for yesterday and today Date: Wed, 16 Oct 2002 10:05:13 -0400 (EDT) Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <87adlgw5vj.fsf@gentoo.shacknet.nu> <86vg43n0vq.fsf@bigwalter.net> <87wuojhs5e.fsf@gentoo.shacknet.nu> Reply-To: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1034969695 16653 80.91.224.249 (18 Oct 2002 19:34:55 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 18 Oct 2002 19:34:55 +0000 (UTC) Cc: Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 182ctV-0004Ja-00 for ; Fri, 18 Oct 2002 21:34:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 182coC-0002dq-00; Fri, 18 Oct 2002 15:29:20 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 182caZ-0007nH-00 for help-gnu-emacs@gnu.org; Fri, 18 Oct 2002 15:15:15 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 182caU-0007kw-00 for help-gnu-emacs@gnu.org; Fri, 18 Oct 2002 15:15:14 -0400 Original-Received: from gnudist.gnu.org ([199.232.41.7]) by monty-python.gnu.org with esmtp (Exim 4.10) id 182caU-0007Lj-00 for help-gnu-emacs@gnu.org; Fri, 18 Oct 2002 15:15:10 -0400 Original-Received: from adsl-65-43-213-176.dsl.bcvloh.ameritech.net ([65.43.213.176] helo=heidegger.mousecar.net) by gnudist.gnu.org with esmtp (Exim 4.10) id 181onY-00005C-00 for help-gnu-emacs@gnu.org; Wed, 16 Oct 2002 10:05:20 -0400 Original-Received: from localhost (ken@localhost) by heidegger.mousecar.net (8.11.6/8.11.6) with ESMTP id g9GE5Hu30508; Wed, 16 Oct 2002 10:05:17 -0400 X-Authentication-Warning: heidegger.mousecar.net: ken owned process doing -bs Original-Newsgroups: gnu.emacs.help X-X-Sender: Original-To: foomaster1200 In-Reply-To: <87wuojhs5e.fsf@gentoo.shacknet.nu> Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:2707 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:2707 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 yesterday's? (defun yesterday-time () (let ((1day-lsw (% 86400 (lsh 1 16))) (1day-msw (/ 86400 (lsh 1 16))) (now (current-time))) (list (+ (car now) 1day-msw) (+ (car (cdr now)) 1day-lsw) (car (cdr (cdr now)))))) Thanks very much, ken -- AMD crashes? See http://cleveland.lug.net/~ken/amd-problem/.