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[] = "@(#)SCLCK.c 8.2 (Berkeley) 05/23/94"; 10 #endif /* not lint */ 11 12 #include <sys/types.h> 13 #include <sys/time.h> 14 #include <sys/resource.h> 15 16 long 17 SCLCK() 18 { 19 struct rusage ru; 20 21 if (getrusage(RUSAGE_SELF, &ru) < 0) 22 return (-1); 23 return (ru.ru_stime.tv_sec * 1000 + ru.ru_stime.tv_usec / 1000); 24 } 25