#include #include #include #include #include #include #include #include #define SYSCALL(s) do { if((s)<0) { perror(#s); exit(1); } } while(0) #define APM_IOC_SETRTC 0x4146 #define APM_IOC_GETRTC 0x4147 int main() { int fd; time_t t; SYSCALL( fd = open("/dev/apm_bios", O_RDWR) ); time(&t); SYSCALL( ioctl(fd, APM_IOC_SETRTC, (void*)&t) ); SYSCALL( close(fd) ); return 0; }