From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Davis Herring" Newsgroups: gmane.emacs.devel Subject: Re: What do I use if not `float-time'? Date: Wed, 6 Jan 2010 07:29:40 -0800 (PST) Message-ID: <41805.130.55.118.19.1262791780.squirrel@webmail.lanl.gov> References: <7b501d5c1001060715j6a9bf132y93d6c55d5af4c511@mail.gmail.com> Reply-To: herring@lanl.gov NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1262792810 31022 80.91.229.12 (6 Jan 2010 15:46:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Jan 2010 15:46:50 +0000 (UTC) Cc: Emacs-Devel devel To: "Deniz Dogan" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 06 16:46:42 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NSY5M-000314-LU for ged-emacs-devel@m.gmane.org; Wed, 06 Jan 2010 16:46:13 +0100 Original-Received: from localhost ([127.0.0.1]:51011 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSXsF-0002xW-4J for ged-emacs-devel@m.gmane.org; Wed, 06 Jan 2010 10:32:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSXpY-0008LW-8n for emacs-devel@gnu.org; Wed, 06 Jan 2010 10:29:52 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSXpS-0008Bc-2m for emacs-devel@gnu.org; Wed, 06 Jan 2010 10:29:51 -0500 Original-Received: from [199.232.76.173] (port=33054 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSXpR-0008BD-Ju for emacs-devel@gnu.org; Wed, 06 Jan 2010 10:29:45 -0500 Original-Received: from proofpoint1.lanl.gov ([204.121.3.25]:50218) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NSXpR-0007Od-5a for emacs-devel@gnu.org; Wed, 06 Jan 2010 10:29:45 -0500 Original-Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by proofpoint1.lanl.gov (8.14.3/8.14.3) with ESMTP id o06FTeU6009696; Wed, 6 Jan 2010 08:29:40 -0700 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 64F371C1BBA; Wed, 6 Jan 2010 08:29:40 -0700 (MST) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay1.lanl.gov Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 5269E1C1BB7; Wed, 6 Jan 2010 08:29:40 -0700 (MST) Original-Received: by webmail1.lanl.gov (Postfix, from userid 48) id 512C31DE0273; Wed, 6 Jan 2010 08:29:40 -0700 (MST) Original-Received: from 130.55.118.19 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Wed, 6 Jan 2010 07:29:40 -0800 (PST) In-Reply-To: <7b501d5c1001060715j6a9bf132y93d6c55d5af4c511@mail.gmail.com> User-Agent: SquirrelMail/1.4.8-5.7.lanl7 X-Priority: 3 (Normal) Importance: Normal X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5, 1.2.40, 4.0.166 definitions=2010-01-06_04:2010-01-05, 2010-01-06, 2010-01-06 signatures=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:119530 Archived-At: > Okay, so what do I use instead? I just want a "UNIX timestamp" as an > integer or string. What's the idiomatic way to get that? Use `current-time'. The trick is that you then have to deal with multiple integers (because Emacs ints are (often) shorter than 32 bits). `float-time' exists to avoid that inconvenience at the cost of another. In practice, using the integer parts of calls to (float-time) should be fine so long as you don't do too much arithmetic on them: doubles have 53 bits of mantissa, and so can represent any reasonable traditional (integer) time stamp exactly. To get a string version of the integer part (which you can't safely turn into an integer!), you can just use (format-time-string "%s"). Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.