aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorPaul Eggert2013-08-27 11:47:55 -0700
committerPaul Eggert2013-08-27 11:47:55 -0700
commit43aac990c339c0fc3304aa476ebc8ea8467f107e (patch)
tree24f6477d7ec79c7f3529e08c421f309b1180c436 /src/xterm.c
parent278208b8e6917af1e7e2623a3869614fa70059ed (diff)
downloademacs-43aac990c339c0fc3304aa476ebc8ea8467f107e.tar.gz
emacs-43aac990c339c0fc3304aa476ebc8ea8467f107e.zip
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.c26
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)
3112 x_flush (f); 3112 x_flush (f);
3113 3113
3114 { 3114 {
3115 EMACS_TIME delay = make_emacs_time (0, 150 * 1000 * 1000); 3115 struct timespec delay = make_timespec (0, 150 * 1000 * 1000);
3116 EMACS_TIME wakeup = add_emacs_time (current_emacs_time (), delay); 3116 struct timespec wakeup = timespec_add (current_timespec (), delay);
3117 3117
3118 /* Keep waiting until past the time wakeup or any input gets 3118 /* Keep waiting until past the time wakeup or any input gets
3119 available. */ 3119 available. */
3120 while (! detect_input_pending ()) 3120 while (! detect_input_pending ())
3121 { 3121 {
3122 EMACS_TIME current = current_emacs_time (); 3122 struct timespec current = current_timespec ();
3123 EMACS_TIME timeout; 3123 struct timespec timeout;
3124 3124
3125 /* Break if result would not be positive. */ 3125 /* Break if result would not be positive. */
3126 if (EMACS_TIME_LE (wakeup, current)) 3126 if (timespec_cmp (wakeup, current) <= 0)
3127 break; 3127 break;
3128 3128
3129 /* How long `select' should wait. */ 3129 /* How long `select' should wait. */
3130 timeout = make_emacs_time (0, 10 * 1000 * 1000); 3130 timeout = make_timespec (0, 10 * 1000 * 1000);
3131 3131
3132 /* Try to wait that long--but we might wake up sooner. */ 3132 /* Try to wait that long--but we might wake up sooner. */
3133 pselect (0, NULL, NULL, NULL, &timeout, NULL); 3133 pselect (0, NULL, NULL, NULL, &timeout, NULL);
@@ -8677,7 +8677,7 @@ x_wait_for_event (struct frame *f, int eventtype)
8677 int level = interrupt_input_blocked; 8677 int level = interrupt_input_blocked;
8678 8678
8679 SELECT_TYPE fds; 8679 SELECT_TYPE fds;
8680 EMACS_TIME tmo, tmo_at, time_now; 8680 struct timespec tmo, tmo_at, time_now;
8681 int fd = ConnectionNumber (FRAME_X_DISPLAY (f)); 8681 int fd = ConnectionNumber (FRAME_X_DISPLAY (f));
8682 8682
8683 pending_event_wait.f = f; 8683 pending_event_wait.f = f;
@@ -8685,8 +8685,8 @@ x_wait_for_event (struct frame *f, int eventtype)
8685 8685
8686 /* Set timeout to 0.1 second. Hopefully not noticeable. 8686 /* Set timeout to 0.1 second. Hopefully not noticeable.
8687 Maybe it should be configurable. */ 8687 Maybe it should be configurable. */
8688 tmo = make_emacs_time (0, 100 * 1000 * 1000); 8688 tmo = make_timespec (0, 100 * 1000 * 1000);
8689 tmo_at = add_emacs_time (current_emacs_time (), tmo); 8689 tmo_at = timespec_add (current_timespec (), tmo);
8690 8690
8691 while (pending_event_wait.eventtype) 8691 while (pending_event_wait.eventtype)
8692 { 8692 {
@@ -8699,11 +8699,11 @@ x_wait_for_event (struct frame *f, int eventtype)
8699 FD_ZERO (&fds); 8699 FD_ZERO (&fds);
8700 FD_SET (fd, &fds); 8700 FD_SET (fd, &fds);
8701 8701
8702 time_now = current_emacs_time (); 8702 time_now = current_timespec ();
8703 if (EMACS_TIME_LT (tmo_at, time_now)) 8703 if (timespec_cmp (tmo_at, time_now) < 0)
8704 break; 8704 break;
8705 8705
8706 tmo = sub_emacs_time (tmo_at, time_now); 8706 tmo = timespec_sub (tmo_at, time_now);
8707 if (pselect (fd + 1, &fds, NULL, NULL, &tmo, NULL) == 0) 8707 if (pselect (fd + 1, &fds, NULL, NULL, &tmo, NULL) == 0)
8708 break; /* Timeout */ 8708 break; /* Timeout */
8709 } 8709 }
@@ -10425,7 +10425,7 @@ x_activate_timeout_atimer (void)
10425 block_input (); 10425 block_input ();
10426 if (!x_timeout_atimer_activated_flag) 10426 if (!x_timeout_atimer_activated_flag)
10427 { 10427 {
10428 EMACS_TIME interval = make_emacs_time (0, 100 * 1000 * 1000); 10428 struct timespec interval = make_timespec (0, 100 * 1000 * 1000);
10429 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); 10429 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0);
10430 x_timeout_atimer_activated_flag = 1; 10430 x_timeout_atimer_activated_flag = 1;
10431 } 10431 }