1
0
Fork 0
forked from len0rd/rockbox

hosted: Fix rtc_write_datetime() error handling

(if mktime() fails, don't attempt to write its result to the RTC)

Change-Id: Ib09b8dccafdef032119db76f10af74dfc220cc21
This commit is contained in:
Solomon Peachy 2021-08-05 09:22:14 -04:00
parent cb6b0d2c0e
commit f3010c6a8e

View file

@ -54,6 +54,9 @@ int rtc_write_datetime(const struct tm *tm)
tv.tv_sec = mktime((struct tm *)tm); tv.tv_sec = mktime((struct tm *)tm);
tv.tv_usec = 0; tv.tv_usec = 0;
if ((int)tv.tv_sec == -1)
return -1;
/* set system clock */ /* set system clock */
settimeofday(&tv, NULL); settimeofday(&tv, NULL);