freebsd-dev/usr.sbin/xntpd/lib/machines.c

62 lines
1.0 KiB
C
Raw Normal View History

1994-02-03 22:09:07 +00:00
/* machines.c - provide special support for peculiar architectures
1993-12-21 18:36:48 +00:00
*
* Real bummers unite !
1994-02-03 22:09:07 +00:00
*
* $FreeBSD$
1993-12-21 18:36:48 +00:00
*/
1994-02-03 22:09:07 +00:00
#include "ntp_stdlib.h"
1993-12-21 18:36:48 +00:00
#ifdef SYS_PTX
#include <sys/types.h>
#include <sys/procstats.h>
1994-02-03 22:09:07 +00:00
int
settimeofday(tvp)
1993-12-21 18:36:48 +00:00
struct timeval *tvp;
{
1994-02-03 22:09:07 +00:00
return (stime(&tvp->tv_sec)); /* lie as bad as SysVR4 */
1993-12-21 18:36:48 +00:00
}
1994-02-03 22:09:07 +00:00
int
gettimeofday(tvp)
1993-12-21 18:36:48 +00:00
struct timeval *tvp;
{
/*
* hi, this is Sequents sneak path to get to a clock
* this is also the most logical syscall for such a function
*/
1994-02-03 22:09:07 +00:00
return (get_process_stats(tvp, PS_SELF, (struct procstats *) 0,
(struct procstats *) 0));
1993-12-21 18:36:48 +00:00
}
#endif
1994-02-03 22:09:07 +00:00
#if !defined(NTP_POSIX_SOURCE) || defined(NTP_NEED_BOPS)
void
ntp_memset(a, x, c)
char *a;
int x, c;
1993-12-21 18:36:48 +00:00
{
1994-02-03 22:09:07 +00:00
while (c-- > 0)
*a++ = x;
1993-12-21 18:36:48 +00:00
}
1994-02-03 22:09:07 +00:00
#endif /*POSIX*/
1994-09-29 23:04:24 +00:00
#if defined(USE_CLOCK_SETTIME)
#include <time.h>
int
settimeofday(tvp)
struct timeval *tvp;
{
struct timespec ts;
/* Convert timeval to timespec */
ts.tv_sec = tvp->tv_sec;
ts.tv_nsec = 1000 * tvp->tv_usec;
return clock_settime(CLOCK_REALTIME, &ts);
}
#endif /* USE_CLOCK_SETTIME */