- 论坛徽章:
- 0
|
经过测试,发现问题出在这个地方:
linux获得的RTC会放到一个结构体中,结构体分为两种,一个是:
struct rtc_time
{
int sec; /* Seconds (0-59) */
int min; /* Minutes (0-59) */
int hour; /* Hour (0-23) */
int dow; /* Day of the week (1-7) */
int dom; /* Day of the month (1-31) */
int month; /* Month of year (1-12) */
int year; /* Year (0-99) */
};
另外一个是:
/*
* The struct used to pass data via the following ioctl. Similar to the
* struct tm in <time.h>, but it needs to be here so that the kernel
* source is self contained, allowing cross-compiles, etc. etc.
*/
struct rtc_time {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon; /* tm_mon starts at zero */
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
而两个的关于月的起始值是不同的,因此在传输等过程中,一不小心就搞错误了! |
|