diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 15 | ||||
| -rw-r--r-- | src/xterm.h | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c index 2239b9fa4e2..eb1a557e883 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6645,7 +6645,11 @@ x_sync_get_monotonic_time (struct x_display_info *dpyinfo, | |||
| 6645 | if (dpyinfo->server_time_monotonic_p) | 6645 | if (dpyinfo->server_time_monotonic_p) |
| 6646 | return timestamp; | 6646 | return timestamp; |
| 6647 | 6647 | ||
| 6648 | return 0; | 6648 | /* This means we haven't yet initialized the server time offset. */ |
| 6649 | if (!dpyinfo->server_time_offset) | ||
| 6650 | return 0; | ||
| 6651 | |||
| 6652 | return timestamp - dpyinfo->server_time_offset; | ||
| 6649 | } | 6653 | } |
| 6650 | 6654 | ||
| 6651 | /* Return the current monotonic time in the same format as a | 6655 | /* Return the current monotonic time in the same format as a |
| @@ -7464,7 +7468,14 @@ x_display_set_last_user_time (struct x_display_info *dpyinfo, Time time, | |||
| 7464 | && time * 1000 < monotonic_time + 500 * 1000) | 7468 | && time * 1000 < monotonic_time + 500 * 1000) |
| 7465 | dpyinfo->server_time_monotonic_p = true; | 7469 | dpyinfo->server_time_monotonic_p = true; |
| 7466 | else | 7470 | else |
| 7467 | dpyinfo->server_time_monotonic_p = false; | 7471 | { |
| 7472 | /* Compute an offset that can be subtracted from the server | ||
| 7473 | time to estimate the monotonic time on the X server. */ | ||
| 7474 | |||
| 7475 | dpyinfo->server_time_monotonic_p = false; | ||
| 7476 | dpyinfo->server_time_offset | ||
| 7477 | = ((int64_t) time * 1000) - monotonic_time; | ||
| 7478 | } | ||
| 7468 | } | 7479 | } |
| 7469 | #endif | 7480 | #endif |
| 7470 | 7481 | ||
diff --git a/src/xterm.h b/src/xterm.h index b656c8dcb2b..fb099e92ea0 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -774,6 +774,10 @@ struct x_display_info | |||
| 774 | /* Whether or not the server time is probably the same as | 774 | /* Whether or not the server time is probably the same as |
| 775 | "clock_gettime (CLOCK_MONOTONIC, ...)". */ | 775 | "clock_gettime (CLOCK_MONOTONIC, ...)". */ |
| 776 | bool server_time_monotonic_p; | 776 | bool server_time_monotonic_p; |
| 777 | |||
| 778 | /* The time difference between the X server clock and the monotonic | ||
| 779 | clock. */ | ||
| 780 | int64_t server_time_offset; | ||
| 777 | #endif | 781 | #endif |
| 778 | }; | 782 | }; |
| 779 | 783 | ||