查看rtc手册页以获取详细信息,但是如果您以root用户身份登录,则如下所示:
#include <linux/rtc.h>#include <sys/ioctl.h> struct rtc_time { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; };int fd;struct rtc_time rt;fd = open("/dev/rtc", O_RDONLY);ioctl(fd, RTC_SET_TIME, &rt);close(fd);


