[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: |
Tue, 15 Oct 2002 11:15:41 -0400 (EDT) |
foo,
Thanks for the reply, but this isn't working for me. Maybe there's more
to it.
The problem seems to be that
(<< 1 16)
yeilds: "Symbol's function definition is void: <<".
I'm using GNU Emacs 20.7.1 (if that could be relevant).
--
AMD crashes? See http://cleveland.lug.net/~ken/amd-problem/.
Spake foomaster1200 at 06:52 (UTC-0000) on Tue, 15 Oct 2002:
= 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.
Emacs is saying they're 16 bits.
>From "C-h f current-time":
Return the current time, as the number of seconds since 1970-01-01
00:00:00.
The time is returned as a list of three integers. The first has the
most significant 16 bits of the seconds, while the second has the
least significant 16 bits. The third integer gives the microsecond
count.
Thanks,
ken