From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: lawrence mitchell Newsgroups: gmane.emacs.help Subject: Re: How to: 96 bit Date-time arithmetic? Date: Sat, 31 Aug 2002 21:49:08 +0100 Organization: funfunfun Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1030827888 22305 127.0.0.1 (31 Aug 2002 21:04:48 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 31 Aug 2002 21:04:48 +0000 (UTC) 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 17lFQF-0005ne-00 for ; Sat, 31 Aug 2002 23:04:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17lFRi-0003ob-00; Sat, 31 Aug 2002 17:06:18 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!m422-mp1.cvx1-a.swa.dial.ntli.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-NNTP-Posting-Host: m422-mp1.cvx1-a.swa.dial.ntli.net (213.105.229.166) Original-X-Trace: fu-berlin.de 1030827107 54631764 213.105.229.166 (16 [97657]) X-No-Yes: No Mail-Copies-To: nobody User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2.90 (i386-mingw-windows98.2222) Cancel-Lock: sha1:OqtVlCxg9x9r/nL+4zHnQDCz0Ro= Original-Xref: nntp.stanford.edu gnu.emacs.help:104353 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:921 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:921 Siegfried Heintze wrote: > While I am still curious about 96 bit arithmetic, here an alternative > attempt. Why does not it work? > (setq x (decode-time (current-time))) > (setq y (list (car x) (cadr x) (caddr x) (1- (cadddr x)) > (nth 5 x) (nth 6 x) (nth 7 x)(nth 8 x) )) ^ (nth 4 x) > (apply 'encode-time x) ; no error > (apply 'encode-time y) ; error -- why? in `nth', N counts from zero. Hence you want (nth 4 x) before (nth 5 x) Notice that: (length x) => 9 (length y) => 8 I'd probably do (setcar (nthcdr 3 x) (1- (nth 3 x))) instead, as it's somewhat easier to read. On another note of style, you probably don't want to use setq unless you've already bound x in a `let' form, or x is indeed a global variable. e.g. (let ((x (decode-time (current-time)))) (setcar (nthcdr 3 x) (1- (nth 3 x))) x) To return the modified value of x. -- lawrence mitchell