help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to do date arithmetic


From: Siegfried Heintze
Subject: How to do date arithmetic
Date: Sat, 19 Apr 2003 17:52:07 GMT

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))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]