unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Siegfried Heintze" <siegfried@heintze.com>
Subject: How to do date arithmetic
Date: Sat, 19 Apr 2003 17:52:07 GMT	[thread overview]
Message-ID: <b1goa.530904$F1.74830@sccrnsc04> (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))

             reply	other threads:[~2003-04-19 17:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-19 17:52 Siegfried Heintze [this message]
2003-04-19 20:17 ` How to do date arithmetic Kai Großjohann

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='b1goa.530904$F1.74830@sccrnsc04' \
    --to=siegfried@heintze.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.
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).