all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christian Lemburg <lemburg@aixonix.de>
Subject: Re: How to: 96 bit Date-time arithmetic?
Date: 04 Sep 2002 09:57:02 +0200	[thread overview]
Message-ID: <m3fzwqw5kh.fsf@maki.aixonix.de> (raw)
In-Reply-To: un1oq9dhjbdva1@corp.supernews.com

"Siegfried Heintze" <siegfried@heintze.com> writes:

> How do I add delta times and subtract absolute times stored in the 96 bit (3
> integer) format? Apparently the functions encode and decode will help me
> convert to and from the 96 bit time format.
> 
> I want to increment times by 1 day and have emacs properly figure out when
> there is a Feb 28.


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


-- 
Christian Lemburg, <lemburg@aixonix.de>, http://www.clemburg.com/
 Hand, n.:
 	A singular instrument worn at the end of a human arm and
 commonly thrust into somebody's pocket.
 		-- Ambrose Bierce, "The Devil's Dictionary"

  parent reply	other threads:[~2002-09-04  7:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-31 15:39 How to: 96 bit Date-time arithmetic? Siegfried Heintze
2002-08-31 18:21 ` Siegfried Heintze
2002-08-31 20:49   ` lawrence mitchell
2002-09-04  7:57 ` Christian Lemburg [this message]
2002-09-04 13:58   ` Alan Shutko

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

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

  git send-email \
    --in-reply-to=m3fzwqw5kh.fsf@maki.aixonix.de \
    --to=lemburg@aixonix.de \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.