unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Davis Herring" <herring@lanl.gov>
To: "Deniz Dogan" <deniz.a.m.dogan@gmail.com>
Cc: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: What do I use if not `float-time'?
Date: Wed, 6 Jan 2010 07:29:40 -0800 (PST)	[thread overview]
Message-ID: <41805.130.55.118.19.1262791780.squirrel@webmail.lanl.gov> (raw)
In-Reply-To: <7b501d5c1001060715j6a9bf132y93d6c55d5af4c511@mail.gmail.com>

> 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.




  reply	other threads:[~2010-01-06 15:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-06 15:15 What do I use if not `float-time'? Deniz Dogan
2010-01-06 15:29 ` Davis Herring [this message]
2010-01-06 20:27   ` Juri Linkov
2010-01-07  1:08     ` Stephen J. Turnbull
2010-01-06 20:40   ` Deniz Dogan

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=41805.130.55.118.19.1262791780.squirrel@webmail.lanl.gov \
    --to=herring@lanl.gov \
    --cc=deniz.a.m.dogan@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

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