jcd@spice.cs.cmu.edu (Jean-Christophe Dhellemmes) (12/07/90)
Hello world,
Here is a question for NeXT experts:
I noticed something weird with the NX_TIMER event. In the event structure,
the "time" field is supposed to contain the absolute time in ticks, each
tick being 1/68 seconds (video frame refresh). This is I think the best way
to get a "real-time" clock on the NeXT.
The problem is that the time field is zero for an event of
type NX_TIMER !!!??? Here is some example code for a modal event loop:
---------------------------------------------------------
NXBeginTimer(&myTimer, myDelay, 0.0);
while(1) {
event = [NXApp getNextEvent:NX_ALLEVENTS];
printf("t: %ld\n", event->time);
if (event->type == NX_TIMER) break;
}
printf("Time's up!\n");
---------------------------------------------------------
If I click with the mouse or type keys, I get a valid time value, but when
the timer event occurs, the last event->time value is zero.
Is this a bug ? How can I get the real-time for the NX_TIMER event ?
Also, if I replace NX_ALLEVENTS by NX_TIMER in the event filter for the
getNextEvent method, the method never returns ! I read in the documentation
that the timer events didn't go through the window server (DPS) so what is
it I am doing wrong ?
Any hint would be greatly appreciated.
* ][]
Jean-Christophe Dhellemmes
Carnegie Mellon University
(jcd@maps.cs.cmu.edu)