]> git.eshelyaron.com Git - emacs.git/commit
Fix overflows in HAVE_XSYNC timestamp handling
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 24 Aug 2022 01:18:13 +0000 (18:18 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 26 Aug 2022 01:30:11 +0000 (18:30 -0700)
commit9bd91a3751cfb01c9499a5ee7080349b9c8f0f65
tree3a701007f17cd937d00ec0e844fd5426014c4efc
parent97067349a8d75ab720ff2e98653a6b21f60b221e
Fix overflows in HAVE_XSYNC timestamp handling

Also, port to platforms lacking CLOCK_MONOTONIC and int64_t, and
use 0 more consistently to represent missing timestamps.
* src/xterm.h (struct x_display_info):
Omit server_time_monotonic_p and server_time_offset if
!HAVE_CLOCK_GETTIME since they are unused in that case.
* src/xterm.h (struct x_display_info, struct x_output):
* src/xterm.c (x_sync_get_monotonic_time)
(x_sync_current_monotonic_time, x_sync_note_frame_times):
Use int_fast64_t instead of int64_t as POSIX doesn't
guarantee the latter.  Similarly for uint_fast64_t.
(x_sync_get_monotonic_time, x_sync_current_monotonic_time)
(x_sync_note_frame_times, x_display_set_last_user_time):
Check for integer overflow in time arithmetic.
(CLOCK_MONOTONIC): Define to CLOCK_REALTIME if absent.
(x_sync_current_monotonic_time): Check for clock_gettime failure
and fall back on CLOCK_REALTIME if CLOCK_MONOTONIC does not work,
which POSIX allows.
(x_sync_current_monotonic_time, x_sync_note_frame_times)
(x_display_set_last_user_time):
Use 0 more consistently to represent missing timestamps.
src/xterm.c
src/xterm.h