File: timer.h

package info (click to toggle)
fkiss 0.33a.patch-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 804 kB
  • ctags: 1,074
  • sloc: ansic: 9,141; sh: 2,924; makefile: 98; sed: 14
file content (54 lines) | stat: -rw-r--r-- 1,602 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* $Header: /home/yav/catty/fkiss/RCS/timer.h,v 1.4 2000/08/24 02:25:50 yav Exp $
 * Time control routine header
 * written by yav <yav@bigfoot.com>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifdef HAVE_GETTIMEOFDAY
#define USE_GETTIMEOFDAY	/* use gettimeofday system call */
#endif

#ifdef HAVE_USLEEP
#define USE_USLEEP		/* use usleep library */
#endif

#ifdef USE_GETTIMEOFDAY
#define TMV timeval
#else
struct TMV {
  long tv_sec;			/* seconds */
  long tv_usec;			/* microseconds */
};
#endif

/* sleep_time(n) macro sleep n milliseconds */
#ifdef USE_USLEEP
#define sleep_time(n) usleep((n)*1000L)	/* to microseconds */
#else
#define sleep_time(n) sleep(((n)+999)/1000) /* to seconds */
#endif

#ifdef USE_GETTIMEOFDAY
#define current_time(p) gettimeofday((p),NULL)
#else
#define current_time(p) ((p)->tv_usec = 0, time(&(p)->tv_sec))
#endif

/* timer.c function prototypes */
long diff_time();
void add_time();

/* End of file */