xref: /original-bsd/usr.bin/pascal/libpc/CLCK.c (revision e61fc7ea)
1 /*-
2  * Copyright (c) 1979 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)CLCK.c	1.4 (Berkeley) 06/29/90";
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