mirror of https://github.com/ARMmbed/mbed-os.git
Fix mktime test DST error
Initialize all values of timeinfo in make_time_info. This prevents the field 'tm_isdst' from getting inadvertently set to 1 causing time to be off by 1 hour.pull/4519/head
parent
d6af53c3ab
commit
adcd2928fe
|
@ -65,13 +65,17 @@ void test_is_leap_year() {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tm make_time_info(int year, int month, int day, int hours, int minutes, int seconds) {
|
struct tm make_time_info(int year, int month, int day, int hours, int minutes, int seconds) {
|
||||||
struct tm timeinfo;
|
struct tm timeinfo = {
|
||||||
timeinfo.tm_year = year;
|
seconds, // tm_sec
|
||||||
timeinfo.tm_mon = month;
|
minutes, // tm_min
|
||||||
timeinfo.tm_mday = day;
|
hours, // tm_hour
|
||||||
timeinfo.tm_hour = hours;
|
day, // tm_mday
|
||||||
timeinfo.tm_min = minutes;
|
month, // tm_mon
|
||||||
timeinfo.tm_sec = seconds;
|
year, // tm_year
|
||||||
|
0, // tm_wday
|
||||||
|
0, // tm_yday
|
||||||
|
0, // tm_isdst
|
||||||
|
};
|
||||||
return timeinfo;
|
return timeinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue