unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to do date arithmetic
@ 2003-04-19 17:52 Siegfried Heintze
  2003-04-19 20:17 ` Kai Großjohann
  0 siblings, 1 reply; 2+ messages in thread
From: Siegfried Heintze @ 2003-04-19 17:52 UTC (permalink / raw)


Some time ago I posted a query on how to perform date-time arithmetic and
received a response that I should look at time-date.el.

I'm running emacs 21.1 and I cannot find time-date.el. Where is it?

I also received a response to use these attached functions. However, the
following fragment doesnot seem to work right:
(current-time)
(16033 34617 85000)
(my-emacs-time->seconds (current-time))
-22968561
(my-seconds->emacs-time (my-emacs-time->seconds (current-time)))
(3745 34606 0)

        Thanks,
                      Siegfried
----------------------------------------------------------------------------
---------------
(defun my-emacs-time->seconds (time)
  "Convert emacs time format to seconds as one 32 bit integer."
  (let ((high (lsh (car time) 16))
(low (cadr time)))
    (logior high low)))

(defun my-seconds->emacs-time (time)
  "Convert one 32 bit integer to emacs time format."
  (list (lsh time -16) (logand time (1- (lsh 1 16))) 0))

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-19 20:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-19 17:52 How to do date arithmetic Siegfried Heintze
2003-04-19 20:17 ` Kai Großjohann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).