diff options
| author | Jim Blandy | 1993-05-04 02:28:10 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-05-04 02:28:10 +0000 |
| commit | b07646f5192832809e0bc76edbf2a73677ec2767 (patch) | |
| tree | ac680510b43984a9fe8c21c73723312261cd3786 /src | |
| parent | e3fa7dfc18bb7236d2a67357e3763225146b62e1 (diff) | |
| download | emacs-b07646f5192832809e0bc76edbf2a73677ec2767.tar.gz emacs-b07646f5192832809e0bc76edbf2a73677ec2767.zip | |
* systime.h: Doc fix.
(EMACS_SET_USECS): Remember that a `usec' is a microsecond, not a
millisecond. What's three orders of magnitude between friends?
* dispnew.c (Fsit_for, Fsleep_for): Remember to multiply the
`milliseconds' argument by 1000 to get microseconds.
* dispnew.c (Fsleep_for, Fsit_for): Allow SECONDS to be a
floating point value.
* dispnew.c (getenv): Extern declaration deleted; this is done in
config.h.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 137555efb9b..4e17a870942 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -1794,22 +1794,32 @@ bitch_at_user () | |||
| 1794 | 1794 | ||
| 1795 | DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0, | 1795 | DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0, |
| 1796 | "Pause, without updating display, for SECONDS seconds.\n\ | 1796 | "Pause, without updating display, for SECONDS seconds.\n\ |
| 1797 | Optional second arg MILLISECONDS specifies an additional wait period,\n\ | 1797 | SECONDS may be a floating-point value, meaning that you can wait for a\n\ |
| 1798 | in milliseconds.\n\ | 1798 | fraction of a second. Optional second arg MILLISECONDS specifies an\n\ |
| 1799 | \(Not all operating systems support milliseconds.)") | 1799 | additional wait period, in milliseconds; this may be useful if your\n\ |
| 1800 | Emacs was built without floating point support.\n\ | ||
| 1801 | \(Not all operating systems support waiting for a fraction of a second.)") | ||
| 1800 | (seconds, milliseconds) | 1802 | (seconds, milliseconds) |
| 1801 | Lisp_Object seconds, milliseconds; | 1803 | Lisp_Object seconds, milliseconds; |
| 1802 | { | 1804 | { |
| 1803 | int sec, usec; | 1805 | int sec, usec; |
| 1804 | 1806 | ||
| 1805 | CHECK_NUMBER (seconds, 0); | ||
| 1806 | sec = XINT (seconds); | ||
| 1807 | |||
| 1808 | if (NILP (milliseconds)) | 1807 | if (NILP (milliseconds)) |
| 1809 | XSET (milliseconds, Lisp_Int, 0); | 1808 | XSET (milliseconds, Lisp_Int, 0); |
| 1810 | else | 1809 | else |
| 1811 | CHECK_NUMBER (milliseconds, 1); | 1810 | CHECK_NUMBER (milliseconds, 1); |
| 1812 | usec = XINT (milliseconds); | 1811 | usec = XINT (milliseconds) * 1000; |
| 1812 | |||
| 1813 | #ifdef LISP_FLOAT_TYPE | ||
| 1814 | { | ||
| 1815 | double duration = extract_float (seconds); | ||
| 1816 | sec = (int) duration; | ||
| 1817 | usec += (duration - sec) * 1000000; | ||
| 1818 | } | ||
| 1819 | #else | ||
| 1820 | CHECK_NUMBER (seconds, 0); | ||
| 1821 | sec = XINT (seconds); | ||
| 1822 | #endif | ||
| 1813 | 1823 | ||
| 1814 | #ifndef EMACS_HAS_USECS | 1824 | #ifndef EMACS_HAS_USECS |
| 1815 | if (sec == 0 && usec != 0) | 1825 | if (sec == 0 && usec != 0) |
| @@ -1934,9 +1944,11 @@ sit_for (sec, usec, reading, display) | |||
| 1934 | 1944 | ||
| 1935 | DEFUN ("sit-for", Fsit_for, Ssit_for, 1, 3, 0, | 1945 | DEFUN ("sit-for", Fsit_for, Ssit_for, 1, 3, 0, |
| 1936 | "Perform redisplay, then wait for SECONDS seconds or until input is available.\n\ | 1946 | "Perform redisplay, then wait for SECONDS seconds or until input is available.\n\ |
| 1937 | Optional second arg MILLISECONDS specifies an additional wait period, in\n\ | 1947 | SECONDS may be a floating-point value, meaning that you can wait for a\n\ |
| 1938 | milliseconds.\n\ | 1948 | fraction of a second. Optional second arg MILLISECONDS specifies an\n\ |
| 1939 | \(Not all operating systems support milliseconds.)\n\ | 1949 | additional wait period, in milliseconds; this may be useful if your\n\ |
| 1950 | Emacs was built without floating point support.\n\ | ||
| 1951 | \(Not all operating systems support waiting for a fraction of a second.)\n\ | ||
| 1940 | Optional third arg non-nil means don't redisplay, just wait for input.\n\ | 1952 | Optional third arg non-nil means don't redisplay, just wait for input.\n\ |
| 1941 | Redisplay is preempted as always if input arrives, and does not happen\n\ | 1953 | Redisplay is preempted as always if input arrives, and does not happen\n\ |
| 1942 | if input is available before it starts.\n\ | 1954 | if input is available before it starts.\n\ |
| @@ -1946,14 +1958,22 @@ Value is t if waited the full time with no input arriving.") | |||
| 1946 | { | 1958 | { |
| 1947 | int sec, usec; | 1959 | int sec, usec; |
| 1948 | 1960 | ||
| 1949 | CHECK_NUMBER (seconds, 0); | ||
| 1950 | sec = XINT (seconds); | ||
| 1951 | |||
| 1952 | if (NILP (milliseconds)) | 1961 | if (NILP (milliseconds)) |
| 1953 | XSET (milliseconds, Lisp_Int, 0); | 1962 | XSET (milliseconds, Lisp_Int, 0); |
| 1954 | else | 1963 | else |
| 1955 | CHECK_NUMBER (milliseconds, 1); | 1964 | CHECK_NUMBER (milliseconds, 1); |
| 1956 | usec = XINT (milliseconds); | 1965 | usec = XINT (milliseconds) * 1000; |
| 1966 | |||
| 1967 | #ifdef LISP_FLOAT_TYPE | ||
| 1968 | { | ||
| 1969 | double duration = extract_float (seconds); | ||
| 1970 | sec = (int) duration; | ||
| 1971 | usec += (duration - sec) * 1000000; | ||
| 1972 | } | ||
| 1973 | #else | ||
| 1974 | CHECK_NUMBER (seconds, 0); | ||
| 1975 | sec = XINT (seconds); | ||
| 1976 | #endif | ||
| 1957 | 1977 | ||
| 1958 | #ifndef EMACS_HAS_USECS | 1978 | #ifndef EMACS_HAS_USECS |
| 1959 | if (usec != 0 && sec == 0) | 1979 | if (usec != 0 && sec == 0) |