Function: sleep-for
sleep-for is a function defined in dispnew.c.
Signature
(sleep-for SECONDS)
Documentation
Pause, without updating display, for SECONDS seconds.
SECONDS may be a floating-point value, meaning that you can wait for a fraction of a second. An optional second arg MILLISECONDS can be provided but is deprecated: it specifies an additional wait period, in milliseconds.
Probably introduced at or before Emacs version 1.4.
Source Code
// Defined in /usr/src/emacs/src/dispnew.c
{
double duration = extract_float (seconds);
if (!NILP (milliseconds))
{
CHECK_FIXNUM (milliseconds);
duration += XFIXNUM (milliseconds) / 1000.0;
}
if (duration > 0)
{
struct timespec t = dtotimespec (duration);
struct timespec tend = timespec_add (current_timespec (), t);
/* wait_reading_process_output returns as soon as it detects
output from any subprocess, so we wait in a loop until the
time expires. */
do {
wait_reading_process_output (min (t.tv_sec, WAIT_READING_MAX),
t.tv_nsec, 0, 0, Qnil, NULL, 0);
t = timespec_sub (tend, current_timespec ());
} while (timespec_sign (t) > 0);
}
return Qnil;
}