Re: Question on C
- From: Tim Müller <zen18864 zen co uk>
- To: Daniel Miralles García <namarie oasi upc es>, gtk-app-devel-list gnome org
- Subject: Re: Question on C
- Date: Thu, 29 Jan 2004 10:42:57 +0000
On Thursday 29 January 2004 10:00, Daniel Miralles García wrote:
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 :)
Just because no one has mentioned it yet: GLib has g_usleep() to sleep for a
number of microseconds, e.g.:
g_usleep(G_USEC_PER_SEC/4);
to sleep for 0.25 seconds.
(the answer to the original question should be g_timeout_add() of course, as
someone else has already mentioned).
Cheers
-Tim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]