#include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { int fd struct timeval tv; fd = open("/dev/parport0",O_RDWR); if (fd == -1) { perror("open"); exit(1); } if (ioctl(fd,PPCLAIM)) { perror("PPCLAIM"); close(fd); exit(1); } if (ioctl(fd, PPGETTIME, &tv)) { perror ("PPNEGOT"); close (fd); return 1; } printf("sec %u usec %u\n",tv.tv_sec, tv.tv_usec); tv.tv_sec = 50; tv.tv_usec = 1000; if (ioctl(fd, PPSETTIME, &tv)) { perror ("PPNEGOT"); close (fd); return 1; } if (ioctl(fd, PPGETTIME, &tv)) { perror ("PPNEGOT"); close (fd); return 1; } printf("sec %u usec %u\n",tv.tv_sec, tv.tv_usec); ioctl (fd, PPRELEASE); close(fd); }