From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Siegfried Heintze" Newsgroups: gmane.emacs.help Subject: How to do date arithmetic Date: Sat, 19 Apr 2003 17:52:07 GMT Organization: AT&T Broadband Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1050775039 21479 80.91.224.249 (19 Apr 2003 17:57:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 19 Apr 2003 17:57:19 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 19 19:57:17 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 196waS-0005a7-00 for ; Sat, 19 Apr 2003 19:57:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 196wZO-0000RX-03 for gnu-help-gnu-emacs@m.gmane.org; Sat, 19 Apr 2003 13:56:10 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc04.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Original-NNTP-Posting-Host: 12.253.86.76 Original-X-Complaints-To: abuse@attbi.com Original-X-Trace: sccrnsc04 1050774727 12.253.86.76 (Sat, 19 Apr 2003 17:52:07 GMT) Original-NNTP-Posting-Date: Sat, 19 Apr 2003 17:52:07 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:112120 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:8619 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:8619 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))