[Top][All Lists]

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

nanosecond-resolution time stamps

From: Paul Eggert
Subject: nanosecond-resolution time stamps
Date: Thu, 30 Jun 2011 23:59:27 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20110516 Thunderbird/3.1.10

Emacs currently uses microsecond-resolution time stamps internally,
whereas GNU and similar operating systems have all gone to
nanosecond-resolution time stamps internally.  This mismatch leads to
problems, for example, Emacs mishandles file time stamps when it
copies them.  I have prepared a set of patches to fix this, and would
like them to be considered for Emacs 24 if possible or for a later
version if not.  I'll send them in other email messages shortly.

The basic idea of these patches is to add 3 digits to the time stamp
format.  For example, currently (current-time) might return
(19981 28208 421496); with the patches, it returns
(19981 28208 421496053) at exactly the same instant.  That is, the
last number of the Emacs internal time stamp now counts nanoseconds,
not microseconds.  (On older machines that do not support finegrained
time stamps the trailing digits are always 000.)

If we're on a 32-bit machine and the nanosecond count exceeds 2**29,
Emacs falls back on floating point to represent the out-of-range
integer.  (There is a similar problem, by the way, with the *first*
number being out of range for integers, on some platforms, and the
patches use the same solution there.)

This change to the internal time stamp format is an incompatible
change and might cause problems with external packages.  If you like,
it'd be easy to alter to the patch to use any other reasonable format.
For example, if you'd prefer the format (19981 28208 421496 053)
(i.e., the sub-microsecond count is appended), I could easily do that.
But I thought I'd get my current code out the door, for review.

(I'm sending this first message now, just a few nanoseconds before
June ends, since that's the cutoff for Emacs 24 changes....)

reply via email to

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