emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] Add conversions to and from struct timespec to module in


From: Paul Eggert
Subject: Re: [PATCH 1/2] Add conversions to and from struct timespec to module interface.
Date: Tue, 23 Apr 2019 08:16:07 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 4/23/19 6:17 AM, Philipp Stephani wrote:
> address@hidden Function struct timespec extract_time (emacs_env 
> address@hidden, emacs_value @var{time})
> +This function interprets @var{time} as an Emacs time value and returns
> +the corresponding @code{struct timespec}.  @xref{Time of Day}.
> address@hidden may not be @code{nil}.

Why not have 'nil' mean the same thing here that it does elsewhere for
Emacs time values, namely, the current time? (That would make the code a
tiny bit faster. :-)

> This function raises an error if

"signals an error"

> +  assert (time.tv_nsec < 1000000000);

2 billion would be safer, to cater to (hypothetical and non-POSIX)
implementations that represent leap seconds with 1 billion <= tv_nsec <
2 billion. That's what timespec_cmp does, anyway.

> +  (dolist (input '(#x10000000000000000  ; out of range
This test will fail to be out of range on (hypothetical) machines where
time_t is 128 bits. How about 1.0e+INF instead? You can test -1.0e+INF
and 0.0e+NaN while you're at it.



reply via email to

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