diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-08-27 11:47:55 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-08-27 11:47:55 -0700 |
commit | 43aac990c339c0fc3304aa476ebc8ea8467f107e (patch) | |
tree | 24f6477d7ec79c7f3529e08c421f309b1180c436 /src/xterm.c | |
parent | 278208b8e6917af1e7e2623a3869614fa70059ed (diff) | |
download | emacs-43aac990c339c0fc3304aa476ebc8ea8467f107e.tar.gz |
Simplify EMACS_TIME-related code.
This portability layer is no longer needed, since Emacs has been
using struct timespec as a portability layer for some time.
Merge from gnulib, incorporating:
2013-08-27 timespec: new convenience constants and function
* src/atimer.h, src/buffer.h, src/dispextern.h, src/xgselect.h:
Include <time.h> rather than "systime.h"; that's all that's needed now.
* src/dispnew.c: Include <timespec.h> rather than "systime.h";
that's all that's needed now.
* src/systime.h (EMACS_TIME): Remove. All uses changed to struct timespec.
(EMACS_TIME_RESOLUTION): Remove. All uses changed to
TIMESPEC_RESOLUTION.
(LOG10_EMACS_TIME_RESOLUTION): Remove. All uses changed to
LOG10_TIMESPEC_RESOLUTION.
(EMACS_SECS, emacs_secs_addr): Remove. All uses changed to tv_sec.
(EMACS_NSECS): Remove. All uses changed to tv_nsec.
(make_emacs_time): Remove. All used changed to make_timespec.
(invalid_timespec): Rename from invalid_emacs_time. All uses changed.
(current_timespec): Rename from current_emacs_time. All uses changed.
(add_emacs_time): Remove. All uses changed to timespec_add.
(sub_emacs_time): Remove. All uses change dot timespec_sub.
(EMACS_TIME_SIGN): Remove. All uses changed to timespec_sign.
(timespec_valid_p): Rename from EMACS_TIME_VALID_P. All uses changed.
(EMACS_TIME_FROM_DOUBLE): Remove. All uses changed to dtotimespec.
(EMACS_TIME_TO_DOUBLE): Remove. All uses changed to timespectod.
(current_timespec): Rename from current_emacs_time. All uses changed.
(EMACS_TIME_EQ, EMACS_TIME_LT, EMACS_TIME_LE): Remove. All uses
changed to timespec_cmp.
* src/xgselect.c: Include <timespec.h>, since our .h files don't.
Diffstat (limited to 'src/xterm.c')
-rw-r--r-- | src/xterm.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/xterm.c b/src/xterm.c index 7014bdb9740..5a67c3b6f2f 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3112,22 +3112,22 @@ XTflash (struct frame *f) x_flush (f); { - EMACS_TIME delay = make_emacs_time (0, 150 * 1000 * 1000); - EMACS_TIME wakeup = add_emacs_time (current_emacs_time (), delay); + struct timespec delay = make_timespec (0, 150 * 1000 * 1000); + struct timespec wakeup = timespec_add (current_timespec (), delay); /* Keep waiting until past the time wakeup or any input gets available. */ while (! detect_input_pending ()) { - EMACS_TIME current = current_emacs_time (); - EMACS_TIME timeout; + struct timespec current = current_timespec (); + struct timespec timeout; /* Break if result would not be positive. */ - if (EMACS_TIME_LE (wakeup, current)) + if (timespec_cmp (wakeup, current) <= 0) break; /* How long `select' should wait. */ - timeout = make_emacs_time (0, 10 * 1000 * 1000); + timeout = make_timespec (0, 10 * 1000 * 1000); /* Try to wait that long--but we might wake up sooner. */ pselect (0, NULL, NULL, NULL, &timeout, NULL); @@ -8677,7 +8677,7 @@ x_wait_for_event (struct frame *f, int eventtype) int level = interrupt_input_blocked; SELECT_TYPE fds; - EMACS_TIME tmo, tmo_at, time_now; + struct timespec tmo, tmo_at, time_now; int fd = ConnectionNumber (FRAME_X_DISPLAY (f)); pending_event_wait.f = f; @@ -8685,8 +8685,8 @@ x_wait_for_event (struct frame *f, int eventtype) /* Set timeout to 0.1 second. Hopefully not noticeable. Maybe it should be configurable. */ - tmo = make_emacs_time (0, 100 * 1000 * 1000); - tmo_at = add_emacs_time (current_emacs_time (), tmo); + tmo = make_timespec (0, 100 * 1000 * 1000); + tmo_at = timespec_add (current_timespec (), tmo); while (pending_event_wait.eventtype) { @@ -8699,11 +8699,11 @@ x_wait_for_event (struct frame *f, int eventtype) FD_ZERO (&fds); FD_SET (fd, &fds); - time_now = current_emacs_time (); - if (EMACS_TIME_LT (tmo_at, time_now)) + time_now = current_timespec (); + if (timespec_cmp (tmo_at, time_now) < 0) break; - tmo = sub_emacs_time (tmo_at, time_now); + tmo = timespec_sub (tmo_at, time_now); if (pselect (fd + 1, &fds, NULL, NULL, &tmo, NULL) == 0) break; /* Timeout */ } @@ -10425,7 +10425,7 @@ x_activate_timeout_atimer (void) block_input (); if (!x_timeout_atimer_activated_flag) { - EMACS_TIME interval = make_emacs_time (0, 100 * 1000 * 1000); + struct timespec interval = make_timespec (0, 100 * 1000 * 1000); start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); x_timeout_atimer_activated_flag = 1; } |