[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: variables for yesterday and today
From: |
foomaster1200 |
Subject: |
Re: variables for yesterday and today |
Date: |
Tue, 15 Oct 2002 06:52:43 GMT |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
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?