xref: /original-bsd/usr.bin/pascal/libpc/CLCK.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1979, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)CLCK.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 #include <sys/time.h>
13 #include <sys/resource.h>
14 
15 long
16 CLCK()
17 {
18 	struct rusage ru;
19 
20 	if (getrusage(RUSAGE_SELF, &ru) < 0)
21 		return (-1);
22 	return (ru.ru_utime.tv_sec * 1000 + ru.ru_utime.tv_usec / 1000);
23 }
24