[Top][All Lists]

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

Re: encode-time vs decode-time

From: Paul Eggert
Subject: Re: encode-time vs decode-time
Date: Mon, 26 Aug 2019 14:35:34 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Adam Porter wrote:
I'm curious, is Emacs fast enough or consistent enough to make use of
high-resolution timestamps anyway?  I guessed that, with GC pauses,
etc., it wouldn't be a suitable platform for such calculations in
real-time.  Although I guess if the timestamps were from outside Emacs,
one could operate on them anyway.

You're right that calling (current-time) from Elisp won't give you nanosecond accuracy; on my platform, just calling that function takes a few hundred nanoseconds so some error is inherent. You're also right that Emacs isn't suitable for hard real-time applications.

As you mention, a common use for Emacs timestamps is to process times generated outside Emacs itself, e.g., file timestamps. On typical POSIXish platforms, file timestamps have nanosecond resolution and range from -2**63 to 2**63 seconds after the epoch, and Emacs can handle all of these timestamps though a few functions like decode-time will probably fail due to limitations of the underlying C libraries.

reply via email to

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