Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] c code timing function.


You can use signals and system timers, for example see the "alarm"  and
"setitimer" functions in the libc info files. You also need to work out how to
write a signal handler.

If you do not need too much precision, you can use the "sleep" function in a
loop.

Cheers

Erich

On Mon, 07 Aug 2000, you wrote:
> hi all
> 
> i am writing a c program and i want it to lie dormant then every say 5
> mins wake up and test somthing and then lie again. It has to be c native
> so i can port it but it must work in linux for the moment, i have
> thought about using time_t but to test that i end up in
> endless loops and all sorts of ugly things. 
> 
> Q
> is there a way to wake up a prog every x seconds in C so no scripts please
> :-)
> 
> 
> thanks
> ghoti
> -- 
> When life is hard to stand try kneeling.
> 
> I never met a calorie i didn't like ;-)
> 
> 
> 
> --
> SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
> More Info: http://slug.org.au/lists/listinfo/slug
-- 
Erich Schulz
Instrumental Technologies
PO Box 6028, Lake Munmorah, NSW 2259
Ph: (+61)0500 551 228 , Fax: (+612) 43583113
Mob: 0408 201 228