emacs-devel
[Top][All Lists]
Advanced

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

Re: Function to make a struct timespec from a floating point number?


From: tomas
Subject: Re: Function to make a struct timespec from a floating point number?
Date: Thu, 20 Jan 2022 19:21:26 +0100

On Thu, Jan 20, 2022 at 08:44:01PM +0800, Po Lu wrote:
> I recall there being a function in the Emacs sources to construct a
> `struct timespec' from a floating point number denoting seconds.

That might be `time-convert':

  (let* ((tim0 (current-time))
         (ftim (float-time tim0))
         (tim1 (time-convert ftim)))
    (message "tim0: %S ftim: %S tim1: %S\n" tim0 ftim tim1))

  => tim0: (25065 42935 269749 160000) ftim: 1642702775.2697492 tim1: (25065 
42935 269749 164581)

(some stuff in the lower bits seems to get lost in translation, alas :)

> I would like to use it to allow setting `polling-period' to a period
> less than one second, so that C-g can be detected faster in the NS port.
> 
> Does anyone remember the name of that function, if it does exist?  I
> don't want to reinvent the wheel.

HTH
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

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