all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: foomaster1200 <foomaster1200@yahoo.com>
Subject: Re: variables for yesterday and today
Date: Tue, 15 Oct 2002 06:52:43 GMT	[thread overview]
Message-ID: <87adlgw5vj.fsf@gentoo.shacknet.nu> (raw)
In-Reply-To: mailman.1034620817.532.help-gnu-emacs@gnu.org

ken <ken@cleveland.lug.net> writes:

> I'm not a great elisp coder, but figured it would be trivial to create a
> couple variables similar to current-time, but containing the values for
> yesterday and tomorrow, bzw. 'current-time - 86400 seconds' and
> 'current-time + 86400 seconds'.
> 
> But it's not trivial at all, at least not how I've seen it.  So before
> reinventing the wheel, has anyone coded these before?

I'm still pretty fresh to LISP in general, but this would be my first
hack;

,----
| (defun yesterday-time ()
|   (let ((1day-lsw (% 86400 (<< 1 16)))
| 	(1day-msw (/ 86400 (<< 1 16)))
| 	(now (current-time)))
|     (list
|       (+ (car now) 1day-msw) 
|       (+ (car (cdr now)) 1day-lsw) 
|       (car (cdr (cdr now))))))
`----

The main thing to remember is integers in Emacs are 28 bits I guess.

-- 
You mean you don't want to watch WRESTLING from ATLANTA?

       reply	other threads:[~2002-10-15  6:52 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 ` foomaster1200 [this message]
2002-10-15 15:15   ` variables for yesterday and today 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
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=87adlgw5vj.fsf@gentoo.shacknet.nu \
    --to=foomaster1200@yahoo.com \
    /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.