mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-23 04:23:08 +00:00
75ce806e1e
- submitter becomes maintainer - Install kmod into /boot/modules instead of /usr/local - Cleared out bits dating back to pre-devfs - Removed #ifdef bits related to FreeBSD <= 4.X and FreeBSD <= 8.X - Olegs fixes for FreeBSD 11.X and FreeBSD 12.X+ - Removed "USES= linux uidfix" - whilst this provides functionality that is "often" used by linux programs, that's not necessarily the case, and this module doesn't require any linux subsystem or kernel MOD to operate. - Removed oldstyle rtc.sh - include pkg-message showing how to load from the rc.conf "kld_list" mechanism. - Fixed typo in "test.c" -> /dec -> /dev - Fixed path to "rtc.h" in "test.c" PR: 233057 Submitted by: Jamie Landeg-Jones <jamie@catflap.org>
57 lines
902 B
C
57 lines
902 B
C
#include <sys/types.h>
|
|
#include <sys/time.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <sys/ioccom.h>
|
|
|
|
#include <rtc.h>
|
|
|
|
|
|
int main(void)
|
|
{
|
|
int rtc;
|
|
fd_set rset;
|
|
int i,rc;
|
|
int ntests=100;
|
|
struct timeval tv;
|
|
struct timeval begin,end,delta;
|
|
|
|
|
|
rtc = open("/dev/rtc", O_RDONLY);
|
|
if (rtc<0) {
|
|
perror("/dev/rtc");
|
|
return 1;
|
|
}
|
|
|
|
rc = ioctl(rtc, RTCIO_IRQP_SET, 512);
|
|
if (rc<0) {
|
|
perror("/dev/rtc");
|
|
return 1;
|
|
}
|
|
|
|
rc = ioctl(rtc, RTCIO_PIE_ON, NULL);
|
|
if (rc<0) {
|
|
perror("/dev/rtc");
|
|
return 1;
|
|
}
|
|
|
|
gettimeofday(&begin, NULL);
|
|
for (i=0; i<ntests; i++) {
|
|
FD_ZERO(&rset);
|
|
FD_SET(rtc, &rset);
|
|
tv.tv_sec=0;
|
|
tv.tv_usec=10000;
|
|
rc=select(rtc+1, &rset, NULL, NULL, &tv);
|
|
}
|
|
gettimeofday(&end, NULL);
|
|
timersub(&end, &begin, &delta);
|
|
printf("time %ld msec per test\n", (delta.tv_sec*1000+delta.tv_usec/1000)/ntests);
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|