Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!udel!rochester!pt.cs.cmu.edu!spice.cs.cmu.edu!jcd From: jcd@spice.cs.cmu.edu (Jean-Christophe Dhellemmes) Newsgroups: comp.sys.next Subject: time in NX_TIMER event ? Keywords: event loop, timing, scheduling Message-ID: <11302@pt.cs.cmu.edu> Date: 6 Dec 90 17:15:47 GMT Organization: Carnegie-Mellon University, CS/RI Lines: 42 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)