[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What do I use if not `float-time'?

From: Davis Herring
Subject: Re: What do I use if not `float-time'?
Date: Wed, 6 Jan 2010 07:29:40 -0800 (PST)
User-agent: SquirrelMail/1.4.8-5.7.lanl7

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


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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]