xref: /csrg-svn/usr.bin/pascal/libpc/SCLCK.c (revision 44647)
140865Sbostic /*-
240865Sbostic  * Copyright (c) 1979 The Regents of the University of California.
340865Sbostic  * All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
71699Smckusick 
840865Sbostic #ifndef lint
9*44647Smckusick static char sccsid[] = "@(#)SCLCK.c	1.4 (Berkeley) 06/29/90";
1040865Sbostic #endif /* not lint */
111699Smckusick 
12*44647Smckusick #include <sys/time.h>
13*44647Smckusick #include <sys/resource.h>
14*44647Smckusick 
153030Smckusic long
161699Smckusick SCLCK()
171699Smckusick {
18*44647Smckusick 	struct rusage ru;
191699Smckusick 
20*44647Smckusick 	if (getrusage(RUSAGE_SELF, &ru) < 0)
21*44647Smckusick 		return (-1);
22*44647Smckusick 	return (ru.ru_stime.tv_sec * 1000 + ru.ru_stime.tv_usec / 1000);
231699Smckusick }
24