Re: Question on C



This hasnt anything to do with GTK+ but I was wondering would any one
know how to program in a delay( say a delay of 2 seconds after clicking
on a button before another event happens). Cheer

Hi.

I'm trying to make a program that controls in real-time executions of 
lightning programs and exporting it through the DMX interface. It must 
have a strong control of timing (miliseconds) and it work (worked until 
few days ago adding some code ;) fine.

If you want a miliseconds pause, you can use this:

void pause (int sec, int msec)
{
        struct timespec delay;
        delay.tv_sec=sec;
        delay.tv_nsec=msec*1000000;
        nanosleep(&delay, NULL);
}

For instance, pause(0,250); makes a 0'250 seconds pause :)

.-:Namarie:-.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]