all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ken <ken@cleveland.lug.net>
Cc: <help-gnu-emacs@gnu.org>
Subject: Re: variables for yesterday and today
Date: Wed, 16 Oct 2002 10:05:13 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.33.0210160949560.3479-100000@heidegger.mousecar.net> (raw)
In-Reply-To: <87wuojhs5e.fsf@gentoo.shacknet.nu>


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

= ken <ken@cleveland.lug.net> 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/.

  reply	other threads:[~2002-10-16 14:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1034620817.532.help-gnu-emacs@gnu.org>
2002-10-15  6:52 ` variables for yesterday and today foomaster1200
2002-10-15 15:15   ` ken
     [not found]   ` <mailman.1034695100.1318.help-gnu-emacs@gnu.org>
2002-10-15 16:05     ` Daniel Jensen
2002-10-15 17:38       ` ken
     [not found]       ` <mailman.1034703565.23323.help-gnu-emacs@gnu.org>
2002-10-16  5:25         ` foomaster1200
2002-10-16 14:05           ` ken [this message]
2002-10-14 18:39 ken

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=Pine.LNX.4.33.0210160949560.3479-100000@heidegger.mousecar.net \
    --to=ken@cleveland.lug.net \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.