ftp.nice.ch/pub/next/unix/communication/newam.0.1.s.tar.gz#/newam-0.1/src/timer.c

This is timer.c in view mode; [Download] [Up]

/*********************************************************************/
/*                                                                   */
/* Programmer:                                                       */
/*   Olaf Mueller <olaf@orest.escape.de>                             */
/*                                                                   */
/* Purpose:                                                          */
/*   Answering Machine                                               */
/*       timer procedure                                             */
/*                                                                   */
/* History:                                                          */
/*   29-08-96   Initial Release           Olaf Mueller               */
/*                                                                   */
/* Notes:                                                            */
/*                                                                   */
/*********************************************************************/

#include "timer.h"


/* returns 0L if setting the timer, duration in msecs if clearing the timer */
long setTimer (int which,long msec)
{
	struct itimerval	alarm , oldalarm ;

	alarm.it_value.tv_sec = msec / 1000 ;
	alarm.it_value.tv_usec = (msec % 1000) * 1000 ;
	alarm.it_interval.tv_sec = alarm.it_interval.tv_usec = 0L ;
	setitimer (which,&alarm,&oldalarm) ;
	return  msec ? 0L : oldalarm.it_value.tv_sec * 1000 + (oldalarm.it_value.tv_usec / 1000) ;
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.