/************************************************************************/
/*                                                                      */
/* Copyright (c) 1988 -                                                 */
/*     The Rector and Visitors of the University of Virginia            */
/*                                                                      */
/* This code may not be distributed further without permission          */
/*      from the University of Virginia.                                */
/* This code is distributed WITHOUT ANY WARRANTY.  No claims are        */
/*      made as to whether it serves any particular purpose or even     */
/*      works at all.                                                   */
/*                                                                      */
/************************************************************************/

#include <sys/types.h>
#include <sys/times.h>
#include <sys/param.h>

extern time_t time();
extern long times();
extern char *ctime();

int 
RT_clock()
{
	struct tms tbuf;
	(void)times(&tbuf);
	return(tbuf.tms_utime * 1000 / HZ);
}

int
RT_sysclock()
{
	struct tms tbuf;
	(void)times(&tbuf);
	return(tbuf.tms_stime * 1000 / HZ);
}

int
RT_wallclock()
{
	return (time((time_t*)0));
}

RT_date(string, leng)
	char *string;
	int leng;
{
	time_t t;
	char *p;
	int i;
	(void)time(&t);
	p = ctime(&t);
	for (i=0; i<leng; i++)
		*string++ = *p != '\n' ? *p++ : ' ';
}
