summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-05-12 13:30:05 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-05-12 13:30:05 -0700
commitf6a24d19906993b975e7be822abbb3cfce719751 (patch)
tree65904cbfb3740b10318aeed84d41cde7a8e8ccdc /src/term.c
parent08dc5ae68e9c699410256ca9052bd09f336ac87f (diff)
* term.c (term_mouse_position): Don't assume time_t wraparound.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/term.c b/src/term.c
index 34320a1ad6..5fe258caa2 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2701,6 +2701,7 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
Lisp_Object *y, Time *timeptr)
{
struct timeval now;
+ Time sec, usec;
*fp = SELECTED_FRAME ();
(*fp)->mouse_moved = 0;
@@ -2711,7 +2712,9 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
XSETINT (*x, last_mouse_x);
XSETINT (*y, last_mouse_y);
gettimeofday(&now, 0);
- *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000);
+ sec = now.tv_sec;
+ usec = now.tv_usec;
+ *timeptr = (sec * 1000) + (usec / 1000);
}
/* Prepare a mouse-event in *RESULT for placement in the input queue.