Re: Question on C
- From: John K Luebs <jkluebs luebsphoto com>
- To: Daniel Miralles Garc?a <namarie oasi upc es>
- Cc: Thomas Keaney <se40319 cs may ie>, gtk-app-devel-list gnome org
- Subject: Re: Question on C
- Date: Sat, 31 Jan 2004 00:23:48 -0500
On Thu, Jan 29, 2004 at 11:00:26AM +0100, Daniel Miralles Garc?a wrote:
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.
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 :)
You should probably name it something other than pause as there is a
POSIX function of the same name.
--jkl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]